[vlc-commits] objects: remove vlc_object_find_name() and associates

Rémi Denis-Courmont git at videolan.org
Sat Apr 13 17:52:50 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 13 18:10:31 2019 +0300| [c7e98fa75a88466b94b1bafae3bac3ba5f634537] | committer: Rémi Denis-Courmont

objects: remove vlc_object_find_name() and associates

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7e98fa75a88466b94b1bafae3bac3ba5f634537
---

 include/vlc_objects.h |  1 -
 src/libvlccore.sym    |  1 -
 src/misc/objects.c    | 41 +----------------------------------------
 src/misc/variables.h  |  3 ---
 4 files changed, 1 insertion(+), 45 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index 3478291b78..908d7a3037 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -91,7 +91,6 @@ struct libvlc_int_t
  * @return the new object, or NULL on error.
  */
 VLC_API void *vlc_object_create( vlc_object_t *, size_t ) VLC_MALLOC VLC_USED;
-VLC_API vlc_object_t *vlc_object_find_name( vlc_object_t *, const char * ) VLC_USED VLC_DEPRECATED;
 
 /**
  * Drops the strong reference to an object.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 552e6a958c..347522e68c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -677,7 +677,6 @@ vlc_mutex_marked
 vlc_global_mutex
 vlc_object_create
 vlc_object_delete
-vlc_object_find_name
 vlc_object_typename
 vlc_object_parent
 vlc_object_Log
diff --git a/src/misc/objects.c b/src/misc/objects.c
index bb634f6d41..e7f718142e 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -55,12 +55,8 @@
 #include <limits.h>
 #include <assert.h>
 
-static vlc_mutex_t tree_lock = VLC_STATIC_MUTEX;
-static struct vlc_list tree_list = VLC_LIST_INITIALIZER(&tree_list);
-
 #define vlc_children_foreach(pos, priv) \
-    vlc_list_foreach(pos, &tree_list, list) \
-        if (pos->parent == vlc_externals(priv))
+    while (((void)(pos), (void)(priv), 0))
 
 #undef vlc_custom_create
 void *vlc_custom_create (vlc_object_t *parent, size_t length,
@@ -96,11 +92,6 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
     {
         obj->obj.logger = parent->obj.logger;
         obj->obj.no_interact = parent->obj.no_interact;
-
-        /* Attach the parent to its child (structure lock needed) */
-        vlc_mutex_lock(&tree_lock);
-        vlc_list_append(&priv->list, &tree_list);
-        vlc_mutex_unlock(&tree_lock);
     }
     else
     {
@@ -131,13 +122,6 @@ void (vlc_object_delete)(vlc_object_t *obj)
 
     assert(priv->resources == NULL);
 
-    if (likely(priv->parent != NULL))
-    {
-        vlc_mutex_lock(&tree_lock);
-        vlc_list_remove(&priv->list);
-        vlc_mutex_unlock(&tree_lock);
-    }
-
     /* Destroy the associated variables. */
     int canc = vlc_savecancel();
     var_DestroyAll(obj);
@@ -148,27 +132,6 @@ void (vlc_object_delete)(vlc_object_t *obj)
     free(priv);
 }
 
-#undef vlc_object_find_name
-/**
- * Finds a named object and increment its reference count.
- * 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.
- * You CANNOT cast the object to a more specific object type, and you
- * definitely cannot invoke object type-specific callbacks with this.
- *
- * @param p_this object to search from
- * @param psz_name name of the object to search for
- *
- * @return a matching object (must be released by the caller),
- * or NULL on error.
- */
-vlc_object_t *vlc_object_find_name( vlc_object_t *p_this, const char *psz_name )
-{
-    (void) p_this; (void) psz_name;
-    return NULL;
-}
-
 void vlc_object_vaLog(vlc_object_t *obj, int prio, const char *module,
                       const char *file, unsigned line, const char *func,
                       const char *format, va_list ap)
@@ -226,13 +189,11 @@ size_t vlc_list_children(vlc_object_t *obj, vlc_object_t **restrict tab,
     vlc_object_internals_t *priv;
     size_t count = 0;
 
-    vlc_mutex_lock(&tree_lock);
     vlc_children_foreach(priv, vlc_internals(obj))
     {
          if (count < max)
              tab[count] = vlc_object_hold(vlc_externals(priv));
          count++;
     }
-    vlc_mutex_unlock(&tree_lock);
     return count;
 }
diff --git a/src/misc/variables.h b/src/misc/variables.h
index 2acd7d4158..0c8b1b2de7 100644
--- a/src/misc/variables.h
+++ b/src/misc/variables.h
@@ -44,9 +44,6 @@ struct vlc_object_internals
     vlc_mutex_t     var_lock;
     vlc_cond_t      var_wait;
 
-    /* Objects tree structure */
-    struct vlc_list list; /**< Legacy list node */
-
     /* Object resources */
     struct vlc_res *resources;
 };



More information about the vlc-commits mailing list