]> git.sesse.net Git - vlc/blobdiff - src/misc/objects.c
Hide thread ID out of VLC_COMMON_MEMBERS
[vlc] / src / misc / objects.c
index 794898e0b9af0d8b1acffeb9735dad4171b0206e..eb22972093abe6cf8d8ec7d6dddf2b40d366daee 100644 (file)
@@ -125,7 +125,6 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
 
     p_new->psz_header = NULL;
 
-    p_new->i_flags = 0;
     if( p_this->i_flags & OBJECT_FLAGS_NODBG )
         p_new->i_flags |= OBJECT_FLAGS_NODBG;
     if( p_this->i_flags & OBJECT_FLAGS_QUIET )
@@ -133,10 +132,9 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT )
         p_new->i_flags |= OBJECT_FLAGS_NOINTERACT;
 
-    p_new->i_vars = 0;
-    p_new->p_vars = (variable_t *)malloc( 16 * sizeof( variable_t ) );
+    p_priv->p_vars = calloc( sizeof( variable_t ), 16 );
 
-    if( !p_new->p_vars )
+    if( !p_priv->p_vars )
     {
         if( i_type != VLC_OBJECT_GLOBAL )
             free( p_priv );
@@ -147,7 +145,6 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     {
         /* If i_type is global, then p_new is actually p_libvlc_global */
         libvlc_global_data_t *p_libvlc_global = (libvlc_global_data_t *)p_new;
-        p_new->p_libvlc_global = p_new;
         p_new->p_libvlc = NULL;
 
         p_libvlc_global->i_counter = 0;
@@ -161,7 +158,6 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     else
     {
         libvlc_global_data_t *p_libvlc_global = vlc_global();
-        p_new->p_libvlc_global = VLC_OBJECT (p_libvlc_global);
         p_new->p_libvlc = ( i_type == VLC_OBJECT_LIBVLC ) ? (libvlc_int_t*)p_new
                                                        : p_this->p_libvlc;
 
@@ -188,7 +184,7 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     /* Initialize mutexes and condvars */
     vlc_mutex_init( p_new, &p_new->object_lock );
     vlc_cond_init( p_new, &p_new->object_wait );
-    vlc_mutex_init( p_new, &p_new->var_lock );
+    vlc_mutex_init( p_new, &p_priv->var_lock );
 
     if( i_type == VLC_OBJECT_GLOBAL )
     {
@@ -392,13 +388,13 @@ void __vlc_object_destroy( vlc_object_t *p_this )
 
     /* Destroy the associated variables, starting from the end so that
      * no memmove calls have to be done. */
-    while( p_this->i_vars )
+    while( p_priv->i_vars )
     {
-        var_Destroy( p_this, p_this->p_vars[p_this->i_vars - 1].psz_name );
+        var_Destroy( p_this, p_priv->p_vars[p_priv->i_vars - 1].psz_name );
     }
 
-    free( p_this->p_vars );
-    vlc_mutex_destroy( &p_this->var_lock );
+    free( p_priv->p_vars );
+    vlc_mutex_destroy( &p_priv->var_lock );
 
     if( p_this->psz_header ) free( p_this->psz_header );
 
@@ -879,11 +875,11 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
 
             PrintObject( p_object, "" );
 
-            if( !p_object->i_vars )
+            if( !p_object->p_internals->i_vars )
                 printf( " `-o No variables\n" );
-            for( i = 0; i < p_object->i_vars; i++ )
+            for( i = 0; i < p_object->p_internals->i_vars; i++ )
             {
-                variable_t *p_var = p_object->p_vars + i;
+                variable_t *p_var = p_object->p_internals->p_vars + i;
 
                 const char *psz_type = "unknown";
                 switch( p_var->i_type & VLC_VAR_TYPE )
@@ -909,7 +905,7 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
 #undef MYCASE
                 }
                 printf( " %c-o \"%s\" (%s",
-                        i + 1 == p_object->i_vars ? '`' : '|',
+                        i + 1 == p_object->p_internals->i_vars ? '`' : '|',
                         p_var->psz_name, psz_type );
                 if( p_var->psz_text )
                     printf( ", %s", p_var->psz_text );
@@ -1211,8 +1207,9 @@ static void PrintObject( vlc_object_t *p_this, const char *psz_prefix )
         snprintf( psz_refcount, 19, ", refcount %i", p_this->i_refcount );
 
     psz_thread[0] = '\0';
-    if( p_this->b_thread )
-        snprintf( psz_thread, 29, " (thread %d)", (int)p_this->thread_id );
+    if( p_this->p_internals->b_thread )
+        snprintf( psz_thread, 29, " (thread %u)",
+                  (unsigned)p_this->p_internals->thread_id );
 
     psz_parent[0] = '\0';
     if( p_this->p_parent )