]> git.sesse.net Git - vlc/commitdiff
Some more vlc_config_* code
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Dec 2007 10:28:24 +0000 (10:28 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Dec 2007 10:28:24 +0000 (10:28 +0000)
include/vlc_configuration.h
src/modules/entry.c

index 7f76f64f1070481ebba116a7698e66cd2023d013..2baae3b64d6d5c9344564a2d2f9a57180526c702 100644 (file)
@@ -247,6 +247,7 @@ typedef enum vlc_config_properties
 } vlc_config_t;
 
 
+VLC_EXPORT( module_config_t *, vlc_config_create, (module_t *, int type) );
 VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
 
 /*****************************************************************************
@@ -367,7 +368,7 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
 
 #define add_bool( name, v, p_callback, text, longtext, advc ) \
     add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, p_callback ); \
-    p_config[i_config].value.i = v
+    if (v) vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)VLC_TRUE)
 
 /* For renamed option */
 #define add_deprecated_alias( name ) \
index 01dae75647693c6f524f6739424b70a54babbc7c..a221483d29a22e4381bc11f7de9b2b99c76195b7 100644 (file)
@@ -142,6 +142,25 @@ int vlc_module_set (module_t *module, int propid, void *value)
     return 0;
 }
 
+module_config_t *vlc_config_create (module_t *module, int type)
+{
+    unsigned confsize = module->confsize;
+    module_config_t *tab = module->p_config;
+
+    if ((confsize & 0xf) == 0)
+    {
+        tab = realloc (tab, (confsize + 17) * sizeof (*tab));
+        if (tab == NULL)
+            return NULL;
+
+        module->p_config = tab;
+    }
+    module->confsize++;
+
+    memset (tab + confsize, 0, sizeof (tab[confsize]));
+    return tab + confsize;
+}
+
 int vlc_config_set (module_config_t *restrict item, vlc_config_t id, ...)
 {
     int ret = -1;