Commit 9d002286 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove unused FIND_PARENT

parent ecc2c16b
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#define VLC_OBJECT_GENERIC (-666) #define VLC_OBJECT_GENERIC (-666)
/* Object search mode */ /* Object search mode */
#define FIND_PARENT 0x0001
#define FIND_CHILD 0x0002 #define FIND_CHILD 0x0002
#define FIND_ANYWHERE 0x0003 #define FIND_ANYWHERE 0x0003
......
...@@ -89,8 +89,7 @@ static int vlc_object_search_mode_from_string( const char *psz_name ) ...@@ -89,8 +89,7 @@ static int vlc_object_search_mode_from_string( const char *psz_name )
int i_mode; int i_mode;
const char *psz_name; const char *psz_name;
} pp_modes[] = } pp_modes[] =
{ { FIND_PARENT, "parent" }, { { FIND_CHILD, "child" },
{ FIND_CHILD, "child" },
{ FIND_ANYWHERE, "anywhere" }, { FIND_ANYWHERE, "anywhere" },
{ 0, "" } }; { 0, "" } };
int i; int i;
...@@ -114,6 +113,7 @@ static int vlclua_object_find_name( lua_State *L ) ...@@ -114,6 +113,7 @@ static int vlclua_object_find_name( lua_State *L )
const char *psz_mode = luaL_checkstring( L, 3 ); const char *psz_mode = luaL_checkstring( L, 3 );
vlc_object_t *p_this; vlc_object_t *p_this;
int i_mode = vlc_object_search_mode_from_string( psz_mode ); int i_mode = vlc_object_search_mode_from_string( psz_mode );
vlc_object_t *p_result; vlc_object_t *p_result;
......
...@@ -223,10 +223,9 @@ object.playlist(): Get the playlist object. ...@@ -223,10 +223,9 @@ object.playlist(): Get the playlist object.
object.libvlc(): Get the libvlc object. object.libvlc(): Get the libvlc object.
object.find( object, type, mode ): Find an object of given type. mode can object.find( object, type, mode ): Find an object of given type. mode can
be any of "parent", "child" and "anywhere". If set to "parent", it will be "child" and "anywhere". If set to "child" it will look in "object"'s
look in "object"'s parent objects. If set to "child" it will look in children. If set to "anywhere", it will look in all the objects. If
"object"'s children. If set to "anywhere", it will look in all the object is unset, the current module's object will be used.
objects. If object is unset, the current module's object will be used.
Type can be: "libvlc", "playlist", "input", "decoder", Type can be: "libvlc", "playlist", "input", "decoder",
"vout", "aout", "packetizer", "generic". "vout", "aout", "packetizer", "generic".
This function is deprecated and slow and should be avoided. This function is deprecated and slow and should be avoided.
......
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
static int DumpCommand( vlc_object_t *, char const *, static int DumpCommand( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static vlc_object_t * FindParentName( vlc_object_t *, const char * );
static vlc_object_t * FindChildName ( vlc_object_internals_t *, const char * ); static vlc_object_t * FindChildName ( vlc_object_internals_t *, const char * );
static void PrintObject( vlc_object_internals_t *, const char * ); static void PrintObject( vlc_object_internals_t *, const char * );
static void DumpStructure( vlc_object_internals_t *, unsigned, char * ); static void DumpStructure( vlc_object_internals_t *, unsigned, char * );
...@@ -243,15 +242,10 @@ char *vlc_object_get_name(const vlc_object_t *obj) ...@@ -243,15 +242,10 @@ char *vlc_object_get_name(const vlc_object_t *obj)
} }
/** /**
**************************************************************************** * Destroys a VLC object once it has no more references.
* Destroy a vlc object (Internal)
*
* This function destroys an object that has been previously allocated with
* vlc_object_create. The object's refcount must be zero and it must not be
* attached to other objects in any way.
* *
* This function must be called with cancellation disabled (currently). * This function must be called with cancellation disabled (currently).
*****************************************************************************/ */
static void vlc_object_destroy( vlc_object_t *p_this ) static void vlc_object_destroy( vlc_object_t *p_this )
{ {
vlc_object_internals_t *p_priv = vlc_internals( p_this ); vlc_object_internals_t *p_priv = vlc_internals( p_this );
...@@ -455,19 +449,10 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this, ...@@ -455,19 +449,10 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
return vlc_object_find_name (VLC_OBJECT(p_this->p_libvlc), psz_name, return vlc_object_find_name (VLC_OBJECT(p_this->p_libvlc), psz_name,
FIND_CHILD); FIND_CHILD);
assert (i_mode == FIND_CHILD);
libvlc_lock (p_this->p_libvlc); libvlc_lock (p_this->p_libvlc);
vlc_mutex_lock (&name_lock); vlc_mutex_lock (&name_lock);
switch (i_mode)
{
case FIND_PARENT:
p_found = FindParentName (p_this, psz_name);
break;
case FIND_CHILD:
p_found = FindChildName (vlc_internals (p_this), psz_name); p_found = FindChildName (vlc_internals (p_this), psz_name);
break;
default:
assert (0);
}
vlc_mutex_unlock (&name_lock); vlc_mutex_unlock (&name_lock);
libvlc_unlock (p_this->p_libvlc); libvlc_unlock (p_this->p_libvlc);
return p_found; return p_found;
...@@ -491,10 +476,10 @@ void * vlc_object_hold( vlc_object_t *p_this ) ...@@ -491,10 +476,10 @@ void * vlc_object_hold( vlc_object_t *p_this )
} }
#undef vlc_object_release #undef vlc_object_release
/***************************************************************************** /**
* Decrement an object refcount * Drops a reference to an object (decrements the reference count).
* And destroy the object if its refcount reach zero. * If the count reaches zero, the object is destroyed.
*****************************************************************************/ */
void vlc_object_release( vlc_object_t *p_this ) void vlc_object_release( vlc_object_t *p_this )
{ {
vlc_object_internals_t *internals = vlc_internals( p_this ); vlc_object_internals_t *internals = vlc_internals( p_this );
...@@ -557,12 +542,11 @@ void vlc_object_release( vlc_object_t *p_this ) ...@@ -557,12 +542,11 @@ void vlc_object_release( vlc_object_t *p_this )
#undef vlc_object_attach #undef vlc_object_attach
/** /**
**************************************************************************** * Exposes a VLC object in the hierarchy by attaching it to another object.
* attach object to a parent object * @note Before variables can be inherited, an object must be attached.
***************************************************************************** * @param p_this object to expose
* This function sets p_this as a child of p_parent, and p_parent as a parent * @param p_parent parent object in the hierarchy
* of p_this. */
*****************************************************************************/
void vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent ) void vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
{ {
if( !p_this ) return; if( !p_this ) return;
...@@ -761,19 +745,6 @@ void vlc_list_release( vlc_list_t *p_list ) ...@@ -761,19 +745,6 @@ void vlc_list_release( vlc_list_t *p_list )
/* Following functions are local */ /* Following functions are local */
static vlc_object_t *FindParentName (vlc_object_t *p_this, const char *name)
{
for (vlc_object_t *parent = p_this->p_parent;
parent != NULL;
parent = parent->p_parent)
{
const char *objname = vlc_internals (parent)->psz_name;
if (objname && !strcmp (objname, name))
return vlc_object_hold (parent);
}
return NULL;
}
static vlc_object_t *FindChildName (vlc_object_internals_t *priv, static vlc_object_t *FindChildName (vlc_object_internals_t *priv,
const char *name) const char *name)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment