Changeset 38f820eb5928f2074a604a2faafdaae7ac594001
- Timestamp:
- 05/14/08 20:17:24
(3 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210789044 +0300
- git-parent:
[c79a340d36130d8f4bd4898a0c076de2472b52ef]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210789044 +0300
- Message:
Inline DetachObject?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rc79a340 |
r38f820e |
|
| 71 | 71 | static vlc_object_t * FindObject ( vlc_object_t *, int, int ); |
|---|
| 72 | 72 | static vlc_object_t * FindObjectName( vlc_object_t *, const char *, int ); |
|---|
| 73 | | static void DetachObject ( vlc_object_t * ); |
|---|
| 74 | 73 | static void PrintObject ( vlc_object_t *, const char * ); |
|---|
| 75 | 74 | static void DumpStructure ( vlc_object_t *, int, char * ); |
|---|
| … | … | |
| 916 | 915 | assert (p_this->p_parent); |
|---|
| 917 | 916 | |
|---|
| 918 | | DetachObject( p_this ); |
|---|
| | 917 | vlc_object_t *p_parent = p_this->p_parent; |
|---|
| | 918 | int i_index, i; |
|---|
| | 919 | |
|---|
| | 920 | /* Remove p_this's parent */ |
|---|
| | 921 | p_this->p_parent = NULL; |
|---|
| | 922 | |
|---|
| | 923 | /* Remove all of p_parent's children which are p_this */ |
|---|
| | 924 | for( i_index = p_parent->i_children ; i_index-- ; ) |
|---|
| | 925 | { |
|---|
| | 926 | if( p_parent->pp_children[i_index] == p_this ) |
|---|
| | 927 | { |
|---|
| | 928 | p_parent->i_children--; |
|---|
| | 929 | for( i = i_index ; i < p_parent->i_children ; i++ ) |
|---|
| | 930 | { |
|---|
| | 931 | p_parent->pp_children[i] = p_parent->pp_children[i+1]; |
|---|
| | 932 | } |
|---|
| | 933 | } |
|---|
| | 934 | } |
|---|
| | 935 | |
|---|
| | 936 | if( p_parent->i_children ) |
|---|
| | 937 | { |
|---|
| | 938 | p_parent->pp_children = (vlc_object_t **)realloc( p_parent->pp_children, |
|---|
| | 939 | p_parent->i_children * sizeof(vlc_object_t *) ); |
|---|
| | 940 | } |
|---|
| | 941 | else |
|---|
| | 942 | { |
|---|
| | 943 | /* Special case - don't realloc() to zero to avoid leaking */ |
|---|
| | 944 | free( p_parent->pp_children ); |
|---|
| | 945 | p_parent->pp_children = NULL; |
|---|
| | 946 | } |
|---|
| 919 | 947 | } |
|---|
| 920 | 948 | |
|---|
| … | … | |
| 1352 | 1380 | } |
|---|
| 1353 | 1381 | |
|---|
| 1354 | | static void DetachObject( vlc_object_t *p_this ) |
|---|
| 1355 | | { |
|---|
| 1356 | | vlc_object_t *p_parent = p_this->p_parent; |
|---|
| 1357 | | int i_index, i; |
|---|
| 1358 | | |
|---|
| 1359 | | /* Remove p_this's parent */ |
|---|
| 1360 | | p_this->p_parent = NULL; |
|---|
| 1361 | | |
|---|
| 1362 | | /* Remove all of p_parent's children which are p_this */ |
|---|
| 1363 | | for( i_index = p_parent->i_children ; i_index-- ; ) |
|---|
| 1364 | | { |
|---|
| 1365 | | if( p_parent->pp_children[i_index] == p_this ) |
|---|
| 1366 | | { |
|---|
| 1367 | | p_parent->i_children--; |
|---|
| 1368 | | for( i = i_index ; i < p_parent->i_children ; i++ ) |
|---|
| 1369 | | { |
|---|
| 1370 | | p_parent->pp_children[i] = p_parent->pp_children[i+1]; |
|---|
| 1371 | | } |
|---|
| 1372 | | } |
|---|
| 1373 | | } |
|---|
| 1374 | | |
|---|
| 1375 | | if( p_parent->i_children ) |
|---|
| 1376 | | { |
|---|
| 1377 | | p_parent->pp_children = (vlc_object_t **)realloc( p_parent->pp_children, |
|---|
| 1378 | | p_parent->i_children * sizeof(vlc_object_t *) ); |
|---|
| 1379 | | } |
|---|
| 1380 | | else |
|---|
| 1381 | | { |
|---|
| 1382 | | free( p_parent->pp_children ); |
|---|
| 1383 | | p_parent->pp_children = NULL; |
|---|
| 1384 | | } |
|---|
| 1385 | | } |
|---|
| 1386 | | |
|---|
| 1387 | 1382 | |
|---|
| 1388 | 1383 | static void PrintObject( vlc_object_t *p_this, const char *psz_prefix ) |
|---|