[vlc-devel] [PATCH 2/7] modules: activation function cannot be NULL

RĂ©mi Denis-Courmont remi at remlab.net
Thu Sep 24 22:00:20 CEST 2020


There would be no ways to use the module. It couldn't even provide
further callbacks. There are indeed no modules with NULL callbacks
at the moment.

As an exception, the LibVLC core "plugin" has a dummy module without
activation callback, but also without capability, so it cannot be
activated anyway. (This is really a design bug in the plugin descriptor
syntax which cannot represent a plugin containing zero modules.)
---
 src/modules/modules.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index cc6e91d9d7..653107b7c6 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -199,20 +199,16 @@ ssize_t vlc_module_match(const char *capability, const char *names,
 static int module_load(vlc_logger_t *log, module_t *m,
                        vlc_activate_t init, bool forced, va_list args)
 {
-    int ret = VLC_SUCCESS;
+    va_list ap;
+    int ret;
 
     if (vlc_plugin_Map(log, m->plugin))
         return VLC_EGENERIC;
 
-    if (m->pf_activate != NULL)
-    {
-        va_list ap;
-
-        va_copy (ap, args);
-        ret = init(m->pf_activate, forced, ap);
-        va_end (ap);
-    }
-
+    assert(m->pf_activate != NULL);
+    va_copy(ap, args);
+    ret = init(m->pf_activate, forced, ap);
+    va_end(ap);
     return ret;
 }
 
-- 
2.28.0



More information about the vlc-devel mailing list