]> git.sesse.net Git - vlc/blobdiff - src/misc/objects.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / misc / objects.c
index 9b8cb98cbc09dbf5380346ce6cc5b7ddabb35b96..65802c77c74cb3d89bc5e3e96acfaf90ac5149c1 100644 (file)
@@ -90,7 +90,6 @@ static void DumpStructure( vlc_object_internals_t *, unsigned, char * );
 static vlc_list_t   * NewList       ( int );
 
 static void vlc_object_destroy( vlc_object_t *p_this );
-static void vlc_object_detach_unlocked (vlc_object_t *p_this);
 
 /*****************************************************************************
  * Local structure lock
@@ -255,9 +254,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
 {
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
 
-    /* Objects are always detached beforehand */
-    assert( !p_this->p_parent );
-
     /* Send a kill to the object's thread if applicable */
     vlc_object_kill( p_this );
 
@@ -584,10 +580,18 @@ void vlc_object_release( vlc_object_t *p_this )
 
     if( b_should_destroy )
     {
+        /* Detach from parent to protect against FIND_CHILDREN */
         parent = p_this->p_parent;
-        if (parent)
-            /* Detach from parent to protect against FIND_CHILDREN */
-            vlc_object_detach_unlocked (p_this);
+        if (likely(parent))
+        {
+           /* Unlink */
+           if (internals->prev != NULL)
+               internals->prev->next = internals->next;
+           else
+               vlc_internals(parent)->first = internals->next;
+           if (internals->next != NULL)
+               internals->next->prev = internals->prev;
+        }
 
         /* We have no children */
         assert (internals->first == NULL);
@@ -638,25 +642,6 @@ void vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
 }
 
 
-static void vlc_object_detach_unlocked (vlc_object_t *p_this)
-{
-    assert (p_this->p_parent != NULL);
-
-    vlc_object_internals_t *pap = vlc_internals (p_this->p_parent);
-    vlc_object_internals_t *priv = vlc_internals (p_this);
-
-    /* Unlink */
-    if (priv->prev != NULL)
-        priv->prev->next = priv->next;
-    else
-        pap->first = priv->next;
-    if (priv->next != NULL)
-        priv->next->prev = priv->prev;
-
-    /* Remove p_this's parent */
-    p_this->p_parent = NULL;
-}
-
 #undef vlc_list_children
 /**
  * Gets the list of children of an objects, and increment their reference
@@ -713,7 +698,6 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
         MYCASE( COORDS, "coords" );
         MYCASE( ADDRESS, "address" );
         MYCASE( MUTEX, "mutex" );
-        MYCASE( LIST, "list" );
 #undef MYCASE
     }
     printf( " *-o \"%s\" (%s", p_var->psz_name, psz_type );
@@ -735,7 +719,7 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
             printf( ": %s", p_var->val.b_bool ? "true" : "false" );
             break;
         case VLC_VAR_INTEGER:
-            printf( ": %d", p_var->val.i_int );
+            printf( ": %"PRId64, p_var->val.i_int );
             break;
         case VLC_VAR_STRING:
             printf( ": \"%s\"", p_var->val.psz_string );
@@ -753,9 +737,6 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
         case VLC_VAR_ADDRESS:
             printf( ": %p", p_var->val.p_address );
             break;
-        case VLC_VAR_LIST:
-            fputs( ": TODO", stdout );
-            break;
     }
     fputc( '\n', stdout );
 }