]> git.sesse.net Git - vlc/commitdiff
Add a module_Exists() function for Simple_Prefs. Don't use too much this function.
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 4 Feb 2007 23:15:19 +0000 (23:15 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 4 Feb 2007 23:15:19 +0000 (23:15 +0000)
include/vlc_modules.h
src/misc/modules.c

index 7f724bdf5f7a209c0bf822df7293d5c2f4346eee..9b4caa94e1d53e96ef97011ceb87caeb49a62e72 100644 (file)
@@ -108,3 +108,5 @@ struct module_t
 VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char *, vlc_bool_t ) );
 #define module_Unneed(a,b) __module_Unneed(VLC_OBJECT(a),b)
 VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
+#define module_Exist(a,b) __module_Exists(VLC_OBJECT(a),b)
+VLC_EXPORT( vlc_bool_t,  __module_Exists, ( vlc_object_t *, const char * ) );
index 25b5bad6abf8205dfdaca63bd9b2f18973500a34..d799571926ef6d0b646c0e92be847910d78de558 100644 (file)
@@ -740,6 +740,31 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module )
     return;
 }
 
+/*****************************************************************************
+ * module_Exists: tell if a module exists.
+ *****************************************************************************
+ * This function is a boolean function that tells if a module exist or not.
+ *****************************************************************************/
+
+vlc_bool_t __module_Exists(  vlc_object_t *p_this, const char * psz_name )
+{
+    vlc_list_t *p_list;
+    int i;
+    p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+    for( i = 0 ; i < p_list->i_count; i++)
+    {
+        if (!strcmp(
+              ((module_t *) p_list->p_values[i].p_object)->psz_shortname ,
+              psz_name ) )
+        {
+            /* We can release the list, and return yes */
+            vlc_list_release( p_list ); return VLC_TRUE;
+        }
+    }
+    vlc_list_release( p_list ); return VLC_FALSE;
+}
+
+
 /*****************************************************************************
  * Following functions are local.
  *****************************************************************************/