Changeset d21779b98ec08fd9ef91468ad76d3737f4209e2c
- Timestamp:
- 29/03/08 15:13:49
(6 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1206800029 +0200
- git-parent:
[e8d99a6b947164f275e2e58bda13f1fcf5795231]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1206800029 +0200
- Message:
Remove some global object-specific hacks
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| re8d99a6 |
rd21779b |
|
| 96 | 96 | *****************************************************************************/ |
|---|
| 97 | 97 | static vlc_mutex_t structure_lock; |
|---|
| 98 | | static vlc_object_internals_t global_internals; |
|---|
| 99 | 98 | |
|---|
| 100 | 99 | void *vlc_custom_create( vlc_object_t *p_this, size_t i_size, |
|---|
| … | … | |
| 104 | 103 | vlc_object_internals_t *p_priv; |
|---|
| 105 | 104 | |
|---|
| | 105 | p_priv = calloc( 1, sizeof( *p_priv ) + i_size ); |
|---|
| | 106 | if( p_priv == NULL ) |
|---|
| | 107 | return NULL; |
|---|
| | 108 | |
|---|
| 106 | 109 | if( i_type == VLC_OBJECT_GLOBAL ) |
|---|
| 107 | | { |
|---|
| 108 | 110 | p_new = p_this; |
|---|
| 109 | | p_priv = &global_internals; |
|---|
| 110 | | memset( p_priv, 0, sizeof( *p_priv ) ); |
|---|
| 111 | | } |
|---|
| 112 | 111 | else |
|---|
| 113 | 112 | { |
|---|
| 114 | 113 | assert (i_size >= sizeof (vlc_object_t)); |
|---|
| 115 | | p_priv = calloc( 1, sizeof( *p_priv ) + i_size ); |
|---|
| 116 | | if( p_priv == NULL ) |
|---|
| 117 | | return NULL; |
|---|
| 118 | | |
|---|
| 119 | 114 | p_new = (vlc_object_t *)(p_priv + 1); |
|---|
| 120 | 115 | } |
|---|
| … | … | |
| 134 | 129 | p_new->psz_header = NULL; |
|---|
| 135 | 130 | |
|---|
| 136 | | if( p_this->i_flags & OBJECT_FLAGS_NODBG ) |
|---|
| 137 | | p_new->i_flags |= OBJECT_FLAGS_NODBG; |
|---|
| 138 | | if( p_this->i_flags & OBJECT_FLAGS_QUIET ) |
|---|
| 139 | | p_new->i_flags |= OBJECT_FLAGS_QUIET; |
|---|
| 140 | | if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT ) |
|---|
| 141 | | p_new->i_flags |= OBJECT_FLAGS_NOINTERACT; |
|---|
| | 131 | p_new->i_flags |= p_this->i_flags |
|---|
| | 132 | & (OBJECT_FLAGS_NODBG|OBJECT_FLAGS_QUIET|OBJECT_FLAGS_NOINTERACT); |
|---|
| 142 | 133 | |
|---|
| 143 | 134 | p_priv->p_vars = calloc( sizeof( variable_t ), 16 ); |
|---|
| … | … | |
| 145 | 136 | if( !p_priv->p_vars ) |
|---|
| 146 | 137 | { |
|---|
| 147 | | if( i_type != VLC_OBJECT_GLOBAL ) |
|---|
| 148 | | free( p_priv ); |
|---|
| | 138 | free( p_priv ); |
|---|
| 149 | 139 | return NULL; |
|---|
| 150 | 140 | } |
|---|
| … | … | |
| 163 | 153 | p_libvlc_global->pp_objects[0] = p_new; |
|---|
| 164 | 154 | p_priv->b_attached = VLC_TRUE; |
|---|
| | 155 | vlc_mutex_init( p_new, &structure_lock ); |
|---|
| 165 | 156 | } |
|---|
| 166 | 157 | else |
|---|
| … | … | |
| 205 | 196 | vlc_spin_init( &p_priv->spin ); |
|---|
| 206 | 197 | p_priv->pipes[0] = p_priv->pipes[1] = -1; |
|---|
| 207 | | |
|---|
| 208 | | if( i_type == VLC_OBJECT_GLOBAL ) |
|---|
| 209 | | { |
|---|
| 210 | | vlc_mutex_init( p_new, &structure_lock ); |
|---|
| 211 | | } |
|---|
| 212 | 198 | |
|---|
| 213 | 199 | if( i_type == VLC_OBJECT_LIBVLC ) |
|---|
| … | … | |
| 435 | 421 | close( p_priv->pipes[0] ); |
|---|
| 436 | 422 | |
|---|
| 437 | | /* global is not dynamically allocated by vlc_object_create */ |
|---|
| 438 | | if( p_this->i_object_type != VLC_OBJECT_GLOBAL ) |
|---|
| 439 | | free( p_priv ); |
|---|
| | 423 | free( p_priv ); |
|---|
| 440 | 424 | } |
|---|
| 441 | 425 | |
|---|
| re8d99a6 |
rd21779b |
|
| 188 | 188 | #endif |
|---|
| 189 | 189 | |
|---|
| 190 | | p_root = vlc_custom_create( p_libvlc_global, 0, VLC_OBJECT_GLOBAL, |
|---|
| 191 | | "global" ); |
|---|
| | 190 | p_root = vlc_custom_create( VLC_OBJECT(p_libvlc_global), 0, |
|---|
| | 191 | VLC_OBJECT_GLOBAL, "global" ); |
|---|
| 192 | 192 | if( p_root == NULL ) |
|---|
| 193 | 193 | i_ret = VLC_ENOMEM; |
|---|