[vlc-devel] [PATCH 6/6] plugin: remove dead enum callback code

RĂ©mi Denis-Courmont remi at remlab.net
Thu Jul 18 21:29:23 CEST 2019


---
 include/vlc_configuration.h |  3 ---
 include/vlc_plugin.h        |  5 ++--
 src/modules/cache.c         | 10 +-------
 src/modules/entry.c         | 48 ++++---------------------------------
 4 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index ee4e57b7c6..f1467c9a0c 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -97,11 +97,8 @@ struct module_config_t
     {
         const char **psz; /**< Table of possible string choices */
         const int  *i; /**< Table of possible integer choices */
-        vlc_string_list_cb psz_cb; /**< Callback to enumerate string choices */
-        vlc_integer_list_cb i_cb; /**< Callback to enumerate integer choices */
     } list; /**< Possible choices */
     const char **list_text; /**< Human-readable names for list values */
-    const char *list_cb_name; /**< Symbol name of the enumeration callback */
     void *owner; /**< Origin run-time linker module handle */
 };
 
diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index d8a7fcb65b..bd06aa224d 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -101,9 +101,8 @@ enum vlc_module_properties
     /* list of suggested values
      * (args=size_t, const <type> *, const char *const *) */
 
-    VLC_CONFIG_LIST_CB,
-    /* callback for suggested values
-     * (args=const char *, size_t (*)(vlc_object_t *, <type> **, char ***)) */
+    VLC_CONFIG_LIST_CB_OBSOLETE,
+    /* unused (ignored) */
 
     /* Insert new VLC_CONFIG_* here */
 };
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 4ff76d4267..c1428bd9f5 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -56,7 +56,7 @@
 #ifdef HAVE_DYNAMIC_PLUGINS
 /* Sub-version number
  * (only used to avoid breakage in dev version when cache structure changes) */
-#define CACHE_SUBVERSION_NUM 35
+#define CACHE_SUBVERSION_NUM 36
 
 /* Cache filename */
 #define CACHE_NAME "plugins.dat"
@@ -201,8 +201,6 @@ static int vlc_cache_load_config(module_config_t *cfg, block_t *file)
 
         if (cfg->list_count)
             cfg->list.psz = xmalloc (cfg->list_count * sizeof (char *));
-        else
-            LOAD_STRING(cfg->list_cb_name);
         for (unsigned i = 0; i < cfg->list_count; i++)
         {
             LOAD_STRING (cfg->list.psz[i]);
@@ -222,8 +220,6 @@ static int vlc_cache_load_config(module_config_t *cfg, block_t *file)
         {
             LOAD_ALIGNOF(*cfg->list.i);
         }
-        else
-            LOAD_STRING(cfg->list_cb_name);
 
         LOAD_ARRAY(cfg->list.i, cfg->list_count);
     }
@@ -527,8 +523,6 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
     if (IsConfigStringType (cfg->i_type))
     {
         SAVE_STRING (cfg->orig.psz);
-        if (cfg->list_count == 0)
-            SAVE_STRING(cfg->list_cb_name);
 
         for (unsigned i = 0; i < cfg->list_count; i++)
             SAVE_STRING (cfg->list.psz[i]);
@@ -543,8 +537,6 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
         {
             SAVE_ALIGNOF(*cfg->list.i);
         }
-        else
-            SAVE_STRING(cfg->list_cb_name);
 
         for (unsigned i = 0; i < cfg->list_count; i++)
              SAVE_IMMEDIATE (cfg->list.i[i]);
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 21eb09bf3c..ebf1a9a771 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -396,7 +396,6 @@ static int vlc_plugin_desc_cb(void *ctx, void *tgt, int propid, ...)
             size_t len = va_arg (ap, size_t);
 
             assert (item->list_count == 0); /* cannot replace choices */
-            assert (item->list.psz_cb == NULL);
             if (len == 0)
                 break; /* nothing to do */
             /* Copy values */
@@ -425,23 +424,6 @@ static int vlc_plugin_desc_cb(void *ctx, void *tgt, int propid, ...)
             break;
         }
 
-        case VLC_CONFIG_LIST_CB:
-        {
-            void *cb;
-
-            item->list_cb_name = va_arg(ap, const char *);
-            cb = va_arg(ap, void *);
-
-            if (IsConfigIntegerType (item->i_type))
-               item->list.i_cb = cb;
-            else
-            if (IsConfigStringType (item->i_type))
-               item->list.psz_cb = cb;
-            else
-                break;
-            break;
-        }
-
         default:
             fprintf (stderr, "LibVLC: unknown module property %d\n", propid);
             fprintf (stderr, "LibVLC: too old to use this module?\n");
@@ -503,7 +485,6 @@ static int vlc_plugin_gpa_cb(void *ctx, void *tgt, int propid, ...)
     {
         case VLC_MODULE_CB_OPEN:
         case VLC_MODULE_CB_CLOSE:
-        case VLC_CONFIG_LIST_CB:
         {
             va_list ap;
 
@@ -588,7 +569,6 @@ static int vlc_plugin_get_symbol(void *root, const char *name,
 int vlc_plugin_resolve(vlc_plugin_t *plugin, vlc_plugin_cb entry)
 {
     void *syms = vlc_plugin_get_symbols(entry);
-    int ret = -1;
 
     /* Resolve modules activate/deactivate callbacks */
     for (module_t *module = plugin->module;
@@ -599,29 +579,11 @@ int vlc_plugin_resolve(vlc_plugin_t *plugin, vlc_plugin_cb entry)
                                   &module->pf_activate)
          || vlc_plugin_get_symbol(syms, module->deactivate_name,
                                   &module->pf_deactivate))
-            goto error;
-    }
-
-    /* Resolve configuration callbacks */
-    for (size_t i = 0; i < plugin->conf.size; i++)
-    {
-        module_config_t *item = plugin->conf.items + i;
-        void *cb;
-
-        if (item->list_cb_name == NULL)
-            continue;
-        if (vlc_plugin_get_symbol(syms, item->list_cb_name, &cb))
-            goto error;
-
-        if (IsConfigIntegerType (item->i_type))
-            item->list.i_cb = cb;
-        else
-        if (IsConfigStringType (item->i_type))
-            item->list.psz_cb = cb;
+        {
+            vlc_plugin_free_symbols(syms);
+            return -1;
+        }
     }
 
-    ret = 0;
-error:
-    vlc_plugin_free_symbols(syms);
-    return ret;
+    return 0;
 }
-- 
2.22.0



More information about the vlc-devel mailing list