[vlc-commits] modules: refactor

Rémi Denis-Courmont git at videolan.org
Sat Sep 26 08:44:00 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Sep 24 22:32:50 2020 +0300| [194bfd8cd013cc23a2f811dee53fb60b00ce87ac] | committer: Rémi Denis-Courmont

modules: refactor

(no functional changes)

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

 src/modules/modules.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index 653107b7c6..004e56c18f 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -196,20 +196,10 @@ ssize_t vlc_module_match(const char *capability, const char *names,
     return matches;
 }
 
-static int module_load(vlc_logger_t *log, module_t *m,
-                       vlc_activate_t init, bool forced, va_list args)
+static
+void *vlc_module_map(vlc_logger_t *log, module_t *module)
 {
-    va_list ap;
-    int ret;
-
-    if (vlc_plugin_Map(log, m->plugin))
-        return VLC_EGENERIC;
-
-    assert(m->pf_activate != NULL);
-    va_copy(ap, args);
-    ret = init(m->pf_activate, forced, ap);
-    va_end(ap);
-    return ret;
+    return vlc_plugin_Map(log, module->plugin) ? NULL : module->pf_activate;
 }
 
 /**
@@ -258,7 +248,16 @@ module_t *(vlc_module_load)(struct vlc_logger *log, const char *capability,
 
     for (size_t i = 0; i < (size_t)total; i++) {
         module_t *cand = mods[i];
-        int ret = module_load(log, cand, probe, i < strict_total, args);
+        int ret = VLC_EGENERIC;
+        void *cb = vlc_module_map(log, cand);
+
+        if (cb != NULL) {
+            va_list ap;
+
+            va_copy(ap, args);
+            ret = probe(cb, i < strict_total, ap);
+            va_end(ap);
+        }
 
         switch (ret) {
             case VLC_SUCCESS:



More information about the vlc-commits mailing list