]> git.sesse.net Git - vlc/blobdiff - src/misc/objects.c
Remove the object ID field
[vlc] / src / misc / objects.c
index 55744a1a084cf95f3bbfb8a6328c5c302e5f68ff..5216552f85ffb618fd3fcaf3ef01e8e6abd521f7 100644 (file)
@@ -89,7 +89,6 @@ static void vlc_object_dump( vlc_object_t *p_this );
  * Local structure lock
  *****************************************************************************/
 static vlc_mutex_t structure_lock;
-static unsigned    object_counter = 0;
 
 static void close_nocancel (int fd)
 {
@@ -179,7 +178,6 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     p_priv->prev = vlc_internals (p_this)->prev;
     vlc_internals (p_this)->prev = p_new;
     vlc_internals (p_priv->prev)->next = p_new;
-    p_new->i_object_id = object_counter++; /* fetch THEN increment */
     vlc_mutex_unlock( &structure_lock );
 
     if( i_type == VLC_OBJECT_LIBVLC )
@@ -514,47 +512,7 @@ void __vlc_object_kill( vlc_object_t *p_this )
 }
 
 
-/**
- * Find an object given its ID.
- *
- * This function looks for the object whose i_object_id field is i_id.
- * This function is slow, and often used to hide bugs. Do not use it.
- * If you need to retain reference to an object, yield the object pointer with
- * vlc_object_yield(), use the pointer as your reference, and call
- * vlc_object_release() when you're done.
- */
-void * vlc_object_get( libvlc_int_t *p_anchor, int i_id )
-{
-    vlc_object_t *obj = NULL;
-#ifndef NDEBUG
-    int canc = vlc_savecancel ();
-    fprintf (stderr, "Use of deprecated vlc_object_get(%d) ", i_id);
-    vlc_backtrace ();
-    vlc_restorecancel (canc);
-#endif
-    vlc_mutex_lock( &structure_lock );
-
-    for( obj = vlc_internals (p_anchor)->next;
-         obj != VLC_OBJECT (p_anchor);
-         obj = vlc_internals (obj)->next )
-    {
-        if( obj->i_object_id == i_id )
-        {
-            vlc_object_yield( obj );
-            goto out;
-        }
-    }
-    obj = NULL;
-#ifndef NDEBUG
-    fprintf (stderr, "Object %d does not exist\n", i_id);
-#endif
-out:
-    vlc_mutex_unlock( &structure_lock );
-    return obj;
-}
-
-/**
- ****************************************************************************
+/*****************************************************************************
  * find a typed object and increment its refcount
  *****************************************************************************
  * This function recursively looks for a given object type. i_mode can be one
@@ -595,7 +553,7 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
  * Beware that objects found in this manner can be "owned" by another thread,
  * be of _any_ type, and be attached to any module (if any). With such an
  * object reference, you can set or get object variables, emit log messages,
- * and read write-once object parameters (i_object_id, psz_object_type, etc).
+ * and read write-once object parameters (psz_object_type, etc).
  * You CANNOT cast the object to a more specific object type, and you
  * definitely cannot invoke object type-specific callbacks with this.
  *
@@ -709,8 +667,8 @@ void __vlc_object_release( vlc_object_t *p_this )
             {
                 /* We are leaking this object */
                 fprintf( stderr,
-                         "ERROR: leaking object (id:%i, type:%s, name:%s)\n",
-                         leaked->i_object_id, leaked->psz_object_type,
+                         "ERROR: leaking object (%p, type:%s, name:%s)\n",
+                         leaked, leaked->psz_object_type,
                          leaked->psz_object_name );
                 /* Dump object to ease debugging */
                 vlc_object_dump( leaked );
@@ -944,13 +902,9 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
         {
             char *end;
             int i_id = strtol( newval.psz_string, &end, 0 );
-            if( !*end )
-                p_object = vlc_object_get( p_libvlc, i_id );
-            else
-                /* try using the object's name to find it */
-                p_object = vlc_object_find_name( p_this, newval.psz_string,
-                                                 FIND_ANYWHERE );
-
+            /* try using the object's name to find it */
+            p_object = vlc_object_find_name( p_this, newval.psz_string,
+                                             FIND_ANYWHERE );
             if( !p_object )
             {
                 return VLC_ENOOBJ;
@@ -1241,10 +1195,10 @@ static void PrintObject( vlc_object_t *p_this, const char *psz_prefix )
 
     psz_parent[0] = '\0';
     if( p_this->p_parent )
-        snprintf( psz_parent, 19, ", parent %i", p_this->p_parent->i_object_id );
+        snprintf( psz_parent, 19, ", parent %p", p_this->p_parent );
 
-    printf( " %so %.8i %s%s%s%s%s%s\n", psz_prefix,
-            p_this->i_object_id, p_this->psz_object_type,
+    printf( " %so %p %s%s%s%s%s%s\n", psz_prefix,
+            p_this, p_this->psz_object_type,
             psz_name, psz_thread, psz_refcount, psz_children,
             psz_parent );
     vlc_restorecancel (canc);