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

Alexandre Janniaux ajanni at videolabs.io
Tue Sep 29 09:38:46 CEST 2020


Hi,

On Mon, Sep 28, 2020 at 09:13:58AM +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().

Actually, calling the function makes no sense if you don't
want to use the result, so VLC_USED makes sense IMHO.

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list