[vlc-commits] modules: activation function cannot be NULL

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Sep 24 22:20:18 2020 +0300| [215421323e1a6e7c945e18b587756ddc0fe0a283] | committer: Rémi Denis-Courmont

modules: activation function cannot be NULL

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.)

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

 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;
 }
 



More information about the vlc-commits mailing list