[vlc-commits] Allow NULL module capability
Rémi Denis-Courmont
git at videolan.org
Mon Aug 15 19:45:23 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 15 18:57:31 2011 +0300| [190fa71e5c6cc33a33623169b3e9e8400aefc398] | committer: Rémi Denis-Courmont
Allow NULL module capability
The module will never be proved. This applies to the "main" module
and the playlist demux (which only has submodules).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=190fa71e5c6cc33a33623169b3e9e8400aefc398
---
src/libvlc-module.c | 1 -
src/modules/entry.c | 2 +-
src/modules/modules.c | 5 ++++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 61bb03e..8189587 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -2811,7 +2811,6 @@ vlc_module_begin ()
/* add_usage_hint( PLAYLIST_USAGE ) */
set_description( N_("main program") )
- set_capability( "main", 100 )
vlc_module_end ()
/*****************************************************************************
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 71cef99..f3d52fe 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -63,7 +63,7 @@ module_t *vlc_module_create (void)
module->psz_help = NULL;
module->pp_shortcuts = NULL;
module->i_shortcuts = 0;
- module->psz_capability = (char*)"";
+ module->psz_capability = NULL;
module->i_score = 1;
module->b_unloadable = true;
module->pf_activate = NULL;
diff --git a/src/modules/modules.c b/src/modules/modules.c
index f260018..cfb2a40 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -190,6 +190,8 @@ void module_LoadPlugins (vlc_object_t *obj)
*/
bool module_provides( const module_t *m, const char *cap )
{
+ if (unlikely(m->psz_capability == NULL))
+ return false;
return !strcmp( m->psz_capability, cap );
}
@@ -1071,7 +1073,8 @@ static void DupModule( module_t *p_module )
/* We strdup() these entries so that they are still valid when the
* module is unloaded. */
- p_module->psz_capability = strdup( p_module->psz_capability );
+ p_module->psz_capability =
+ p_module->psz_capability ? strdup( p_module->psz_capability ) : NULL;
p_module->psz_shortname = p_module->psz_shortname ?
strdup( p_module->psz_shortname ) : NULL;
p_module->psz_longname = strdup( p_module->psz_longname );
More information about the vlc-commits
mailing list