* Local structure lock
*****************************************************************************/
static vlc_mutex_t structure_lock;
-static unsigned object_counter = 0;
static void close_nocancel (int fd)
{
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 )
}
-/**
- * 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
* 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.
*
{
/* 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 );
{
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;
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);