Changeset 52d943331f7d21d9de67d025ff06d33d0ae5eee8
- 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
| r38f820e |
r52d9433 |
|
| 74 | 74 | static void DumpStructure ( vlc_object_t *, int, char * ); |
|---|
| 75 | 75 | static int FindIndex ( vlc_object_t *, vlc_object_t **, int ); |
|---|
| 76 | | static void SetAttachment ( vlc_object_t *, bool ); |
|---|
| 77 | 76 | |
|---|
| 78 | 77 | static vlc_list_t * NewList ( int ); |
|---|
| 79 | 78 | static 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 * );*/ |
|---|
| 81 | 80 | static int CountChildren ( vlc_object_t *, int ); |
|---|
| 82 | 81 | static void ListChildren ( vlc_list_t *, vlc_object_t *, int ); |
|---|
| … | … | |
| 972 | 971 | |
|---|
| 973 | 972 | |
|---|
| 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 | | |
|---|
| 986 | 973 | /** |
|---|
| 987 | 974 | **************************************************************************** |
|---|
| … | … | |
| 994 | 981 | { |
|---|
| 995 | 982 | 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; |
|---|
| 1000 | 984 | |
|---|
| 1001 | 985 | /* Look for the objects */ |
|---|
| … | … | |
| 1003 | 987 | { |
|---|
| 1004 | 988 | 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); |
|---|
| 1009 | 990 | |
|---|
| 1010 | 991 | case FIND_CHILD: |
|---|
| | 992 | vlc_mutex_lock( &structure_lock ); |
|---|
| 1011 | 993 | i_count = CountChildren( p_this, i_type ); |
|---|
| 1012 | 994 | p_list = NewList( i_count ); |
|---|
| … | … | |
| 1022 | 1004 | p_list->i_count = 0; |
|---|
| 1023 | 1005 | ListChildren( p_list, p_this, i_type ); |
|---|
| | 1006 | vlc_mutex_unlock( &structure_lock ); |
|---|
| 1024 | 1007 | break; |
|---|
| 1025 | 1008 | |
|---|
| … | … | |
| 1029 | 1012 | break; |
|---|
| 1030 | 1013 | } |
|---|
| 1031 | | |
|---|
| 1032 | | vlc_mutex_unlock( &structure_lock ); |
|---|
| 1033 | 1014 | |
|---|
| 1034 | 1015 | return p_list; |
|---|
| … | … | |
| 1512 | 1493 | } |
|---|
| 1513 | 1494 | |
|---|
| 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 ) |
|---|
| 1515 | 1496 | { |
|---|
| 1516 | 1497 | if( p_list == NULL ) |
|---|
| … | … | |
| 1533 | 1514 | |
|---|
| 1534 | 1515 | return; |
|---|
| 1535 | | } |
|---|
| | 1516 | }*/ |
|---|
| 1536 | 1517 | |
|---|
| 1537 | 1518 | static int CountChildren( vlc_object_t *p_this, int i_type ) |
|---|