Changeset 30066f7bd1ce28d48032737de40d96bdff516bf4

Show
Ignore:
Timestamp:
05/14/08 20:11:18 (2 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210788678 +0300
git-parent:

[ef626a5dee4e9324a14e4f6b20be7cd518bafffe]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210788678 +0300
Message:

Recurse through the object tree instead of using the objects table

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/objects.c

    rb187d11 r30066f7  
    7979static vlc_list_t   * NewList       ( int ); 
    8080static void           ListReplace   ( vlc_list_t *, vlc_object_t *, int ); 
    81 /*static void           ListAppend    ( vlc_list_t *, vlc_object_t * );*/ 
     81static void           ListAppend    ( vlc_list_t *, vlc_object_t * ); 
    8282static int            CountChildren ( vlc_object_t *, int ); 
    8383static void           ListChildren  ( vlc_list_t *, vlc_object_t *, int ); 
     
    960960} 
    961961 
     962 
     963static void vlc_tree_find (vlc_object_t *node, int type, vlc_list_t *list) 
     964{ 
     965    assert (node); 
     966    vlc_assert_locked (&structure_lock); 
     967 
     968    if (node->i_object_type == type) 
     969        ListAppend (list, node); 
     970 
     971    for (int i = 0; i < node->i_children; i++) 
     972        vlc_tree_find (node->pp_children[i], type, list); 
     973} 
     974 
    962975/** 
    963976 **************************************************************************** 
     
    970983{ 
    971984    vlc_list_t *p_list; 
    972     vlc_object_t **pp_current, **pp_end; 
    973985    int i_count = 0, i_index = 0; 
    974986    libvlc_global_data_t *p_libvlc_global = vlc_global(); 
     
    980992    { 
    981993    case FIND_ANYWHERE: 
    982         pp_current = p_libvlc_global->pp_objects; 
    983         pp_end = pp_current + p_libvlc_global->i_objects; 
    984  
    985         for( ; pp_current < pp_end ; pp_current++ ) 
    986         { 
    987             if( vlc_internals(*pp_current)->b_attached 
    988                  && (*pp_current)->i_object_type == i_type ) 
    989             { 
    990                 i_count++; 
    991             } 
    992         } 
    993  
    994         p_list = NewList( i_count ); 
    995         pp_current = p_libvlc_global->pp_objects; 
    996  
    997         for( ; pp_current < pp_end ; pp_current++ ) 
    998         { 
    999             if( vlc_internals(*pp_current)->b_attached 
    1000                  && (*pp_current)->i_object_type == i_type ) 
    1001             { 
    1002                 ListReplace( p_list, *pp_current, i_index ); 
    1003                 if( i_index < i_count ) i_index++; 
    1004             } 
    1005         } 
    1006     break; 
     994        p_list = NewList (0); 
     995        if (p_list != NULL) 
     996            vlc_tree_find (VLC_OBJECT (p_libvlc_global), i_type, p_list); 
     997        break; 
    1007998 
    1008999    case FIND_CHILD: 
     
    15711562} 
    15721563 
    1573 /*static void ListAppend( vlc_list_t *p_list, vlc_object_t *p_object ) 
     1564static void ListAppend( vlc_list_t *p_list, vlc_object_t *p_object ) 
    15741565{ 
    15751566    if( p_list == NULL ) 
     
    15921583 
    15931584    return; 
    1594 }*/ 
     1585} 
    15951586 
    15961587static int CountChildren( vlc_object_t *p_this, int i_type )