]> git.sesse.net Git - vlc/commitdiff
Remove unused FIND_PARENT
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 25 May 2011 15:52:10 +0000 (18:52 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 25 May 2011 15:52:10 +0000 (18:52 +0300)
include/vlc_objects.h
modules/lua/libs/objects.c
share/lua/README.txt
src/misc/objects.c

index 7fe95d5d8832b84d48e728d49e0d4b81e0e71d9e..f6ac4219a6c86ebe00562aa8b950ba9218386906 100644 (file)
@@ -41,7 +41,6 @@
 #define VLC_OBJECT_GENERIC     (-666)
 
 /* Object search mode */
-#define FIND_PARENT         0x0001
 #define FIND_CHILD          0x0002
 #define FIND_ANYWHERE       0x0003
 
index b4128502ac427a722c0833d4ba5444cef8d0245c..96905c0208d804a6155faa5cea579f4b37e6c16d 100644 (file)
@@ -89,8 +89,7 @@ static int vlc_object_search_mode_from_string( const char *psz_name )
         int i_mode;
         const char *psz_name;
     } pp_modes[] =
-        { { FIND_PARENT, "parent" },
-          { FIND_CHILD, "child" },
+        { { FIND_CHILD, "child" },
           { FIND_ANYWHERE, "anywhere" },
           { 0, "" } };
     int i;
@@ -114,6 +113,7 @@ static int vlclua_object_find_name( lua_State *L )
     const char *psz_mode = luaL_checkstring( L, 3 );
 
     vlc_object_t *p_this;
+
     int i_mode = vlc_object_search_mode_from_string( psz_mode );
     vlc_object_t *p_result;
 
index 9714109eb0d4f82f892efc42036da4e7477a605e..15b2115c1283c698df5fac5bc2d9b7c07ffb3d0f 100644 (file)
@@ -223,10 +223,9 @@ object.playlist(): Get the playlist object.
 object.libvlc(): Get the libvlc object.
 
 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
-  look in "object"'s parent objects. If set to "child" it will look in
-  "object"'s children. If set to "anywhere", it will look in all the
-  objects. If object is unset, the current module's object will be used.
+  be "child" and "anywhere". If set to "child" it will look in "object"'s
+  children. If set to "anywhere", it will look in all the objects. If
+  object is unset, the current module's object will be used.
   Type can be: "libvlc", "playlist", "input", "decoder",
   "vout", "aout", "packetizer", "generic".
   This function is deprecated and slow and should be avoided.
index ddc559b48d7c6106123cbf40eab9ecbc8f719e7d..45bd9ec004d611bf419807bbee56dd61c2e7289b 100644 (file)
@@ -85,7 +85,6 @@
 static int  DumpCommand( vlc_object_t *, char const *,
                          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 void PrintObject( vlc_object_internals_t *, const char * );
 static void DumpStructure( vlc_object_internals_t *, unsigned, char * );
@@ -243,15 +242,10 @@ char *vlc_object_get_name(const vlc_object_t *obj)
 }
 
 /**
- ****************************************************************************
- * 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.
+ * Destroys a VLC object once it has no more references.
  *
  * This function must be called with cancellation disabled (currently).
- *****************************************************************************/
+ */
 static void vlc_object_destroy( vlc_object_t *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,
         return vlc_object_find_name (VLC_OBJECT(p_this->p_libvlc), psz_name,
                                      FIND_CHILD);
 
+    assert (i_mode == FIND_CHILD);
     libvlc_lock (p_this->p_libvlc);
     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);
-            break;
-        default:
-            assert (0);
-    }
+    p_found = FindChildName (vlc_internals (p_this), psz_name);
     vlc_mutex_unlock (&name_lock);
     libvlc_unlock (p_this->p_libvlc);
     return p_found;
@@ -491,10 +476,10 @@ void * vlc_object_hold( vlc_object_t *p_this )
 }
 
 #undef vlc_object_release
-/*****************************************************************************
- * Decrement an object refcount
- * And destroy the object if its refcount reach zero.
- *****************************************************************************/
+/**
+ * Drops a reference to an object (decrements the reference count).
+ * If the count reaches zero, the object is destroyed.
+ */
 void vlc_object_release( vlc_object_t *p_this )
 {
     vlc_object_internals_t *internals = vlc_internals( p_this );
@@ -557,12 +542,11 @@ void vlc_object_release( vlc_object_t *p_this )
 
 #undef vlc_object_attach
 /**
- ****************************************************************************
- * attach object to a parent object
- *****************************************************************************
- * This function sets p_this as a child of p_parent, and p_parent as a parent
- * of p_this.
- *****************************************************************************/
+ * Exposes a VLC object in the hierarchy by attaching it to another object.
+ * @note Before variables can be inherited, an object must be attached.
+ * @param p_this object to expose
+ * @param p_parent parent object in the hierarchy
+ */
 void vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
 {
     if( !p_this ) return;
@@ -761,19 +745,6 @@ void vlc_list_release( vlc_list_t *p_list )
 
 /* 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,
                                     const char *name)
 {