Changeset 52d943331f7d21d9de67d025ff06d33d0ae5eee8

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

[38f820eb5928f2074a604a2faafdaae7ac594001]

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

Hmm, there was a simpler solution

(Code re-use rules)

Files:

Legend:

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

    r38f820e r52d9433  
    7474static void           DumpStructure ( vlc_object_t *, int, char * ); 
    7575static int            FindIndex     ( vlc_object_t *, vlc_object_t **, int ); 
    76 static void           SetAttachment ( vlc_object_t *, bool ); 
    7776 
    7877static vlc_list_t   * NewList       ( int ); 
    7978static void           ListReplace   ( vlc_list_t *, vlc_object_t *, int ); 
    80 static void           ListAppend    ( vlc_list_t *, vlc_object_t * ); 
     79/*static void           ListAppend    ( vlc_list_t *, vlc_object_t * );*/ 
    8180static int            CountChildren ( vlc_object_t *, int ); 
    8281static void           ListChildren  ( vlc_list_t *, vlc_object_t *, int ); 
     
    972971 
    973972 
    974 static void vlc_tree_find (vlc_object_t *node, int type, vlc_list_t *list) 
    975 { 
    976     assert (node); 
    977     vlc_assert_locked (&structure_lock); 
    978  
    979     if (node->i_object_type == type) 
    980         ListAppend (list, node); 
    981  
    982     for (int i = 0; i < node->i_children; i++) 
    983         vlc_tree_find (node->pp_children[i], type, list); 
    984 } 
    985  
    986973/** 
    987974 **************************************************************************** 
     
    994981{ 
    995982    vlc_list_t *p_list; 
    996     int i_count = 0, i_index = 0; 
    997     libvlc_global_data_t *p_libvlc_global = vlc_global(); 
    998  
    999     vlc_mutex_lock( &structure_lock ); 
     983    int i_count = 0; 
    1000984 
    1001985    /* Look for the objects */ 
     
    1003987    { 
    1004988    case FIND_ANYWHERE: 
    1005         p_list = NewList (0); 
    1006         if (p_list != NULL) 
    1007             vlc_tree_find (VLC_OBJECT (p_libvlc_global), i_type, p_list); 
    1008         break; 
     989        return vlc_list_find (vlc_global (), i_type, FIND_CHILD); 
    1009990 
    1010991    case FIND_CHILD: 
     992        vlc_mutex_lock( &structure_lock ); 
    1011993        i_count = CountChildren( p_this, i_type ); 
    1012994        p_list = NewList( i_count ); 
     
    10221004        p_list->i_count = 0; 
    10231005        ListChildren( p_list, p_this, i_type ); 
     1006        vlc_mutex_unlock( &structure_lock ); 
    10241007        break; 
    10251008 
     
    10291012        break; 
    10301013    } 
    1031  
    1032     vlc_mutex_unlock( &structure_lock ); 
    10331014 
    10341015    return p_list; 
     
    15121493} 
    15131494 
    1514 static void ListAppend( vlc_list_t *p_list, vlc_object_t *p_object ) 
     1495/*static void ListAppend( vlc_list_t *p_list, vlc_object_t *p_object ) 
    15151496{ 
    15161497    if( p_list == NULL ) 
     
    15331514 
    15341515    return; 
    1535 } 
     1516}*/ 
    15361517 
    15371518static int CountChildren( vlc_object_t *p_this, int i_type )