[vlc-devel] [PATCH 1/2] modules: inline module_exists()

Lyndon Brown jnqnfe at gmail.com
Tue Sep 29 00:50:36 CEST 2020


On Mon, 2020-09-28 at 09:13 +0200, Steve Lhomme wrote:
> On 2020-09-27 1:35, Lyndon Brown wrote:
> > From: Lyndon Brown <jnqnfe at gmail.com>
> > Date: Mon, 8 Apr 2019 15:01:32 +0100
> > Subject: modules: inline module_exists()
> > 
> > 
> > diff --git a/include/vlc_modules.h b/include/vlc_modules.h
> > index 6dbb891240..3927252469 100644
> > --- a/include/vlc_modules.h
> > +++ b/include/vlc_modules.h
> > @@ -124,15 +124,6 @@ static inline module_t
> > *module_need_var(vlc_object_t *obj, const char *cap,
> >   VLC_API void module_unneed( vlc_object_t *, module_t * );
> >   #define module_unneed(a,b) module_unneed(VLC_OBJECT(a),b)
> >   
> > -/**
> > - * Checks if a module exists.
> > - *
> > - * \param name name of the module
> > - * \retval true if the module exists
> > - * \retval false if the module does not exist (in the running
> > installation)
> > - */
> > -VLC_API bool module_exists(const char *) VLC_USED;
> > -
> >   /**
> >    * Get a pointer to a module_t given it's name.
> >    *
> > @@ -141,6 +132,18 @@ VLC_API bool module_exists(const char *)
> > VLC_USED;
> >    */
> >   VLC_API module_t *module_find(const char *name) VLC_USED;
> >   
> > +/**
> > + * Checks if a module exists.
> > + *
> > + * \param name name of the module
> > + * \retval true if the module exists
> > + * \retval false if the module does not exist (in the running
> > installation)
> > + */
> > +VLC_USED static inline bool module_exists (const char * name)
> 
> I don't think you need the VLC_USED here. It doesn't matter if you
> use 
> the result or not (although in that case the call is useless). It
> could 
> trigger warnings if it's called in an assert().
> 
> Other than that, it's a good idea to make it an inline.

The used attribute is already there. I didn't want to presume that it
would be acceptable to drop it, or sneak that change in without
comment...

> > +{
> > +    return module_find(name) != NULL;
> > +}
> > +
> >   /**
> >    * Gets the table of module configuration items.
> >    *
> > diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> > index 4c6c588f73..f2ec433f02 100644
> > --- a/src/libvlccore.sym
> > +++ b/src/libvlccore.sym
> > @@ -253,7 +253,6 @@ vlc_uri_fixup
> >   vlc_tick_now
> >   module_config_free
> >   module_config_get
> > -module_exists
> >   module_find
> >   module_get_capability
> >   module_get_help
> > diff --git a/src/modules/modules.c b/src/modules/modules.c
> > index 2b9ed30fe0..1b8cab86a6 100644
> > --- a/src/modules/modules.c
> > +++ b/src/modules/modules.c
> > @@ -329,11 +329,6 @@ module_t *module_find (const char *name)
> >       return NULL;
> >   }
> >   
> > -bool module_exists (const char * psz_name)
> > -{
> > -    return module_find (psz_name) != NULL;
> > -}
> > -
> >   module_config_t *module_config_get( const module_t *module,
> > unsigned *restrict psize )
> >   {
> >       const vlc_plugin_t *plugin = module->plugin;
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list