[vlc-devel] [PATCH 4/6] modules: remove vlc_module_unload() inconvenience wrapper

Steve Lhomme robux4 at ycbcr.xyz
Thu Jul 25 06:50:43 CEST 2019


+1 as it totally doesn't do what the name suggests

On 2019-07-24 21:38, RĂ©mi Denis-Courmont wrote:
> ---
>   include/vlc_modules.h | 17 -----------------
>   include/vlc_objects.h |  5 ++---
>   src/libvlccore.sym    |  1 -
>   src/modules/modules.c | 13 -------------
>   4 files changed, 2 insertions(+), 34 deletions(-)
> 
> diff --git a/include/vlc_modules.h b/include/vlc_modules.h
> index d0115a7ede..430863953c 100644
> --- a/include/vlc_modules.h
> +++ b/include/vlc_modules.h
> @@ -29,7 +29,6 @@
>    */
>   
>   typedef int (*vlc_activate_t)(void *func, bool forced, va_list args);
> -typedef void (*vlc_deactivate_t)(void *func, va_list args);
>   struct vlc_logger;
>   
>   /*****************************************************************************
> @@ -71,22 +70,6 @@ VLC_API module_t *vlc_module_load(struct vlc_logger *log, const char *cap,
>                               name, strict, __VA_ARGS__))
>   #endif
>   
> -/**
> - * Deinstantiates a module.
> - *
> - * This is an inconvenience wrapper for deactivating a module if the module
> - * capability/type expects it. In that fashion, it is paired with
> - * vlc_module_load(). It is rather inconvenient however, as it requires
> - * variable arguments for no good reasons, and inhibits type safety.
> - *
> - * In practice, it is easier to treat vlc_module_load() as an object "factory",
> - * and define a type-safe custom callback for object deletion.
> - *
> - * \param module the module pointer as returned by vlc_module_load()
> - * \param deinit deactivation callback
> - */
> -VLC_API void vlc_module_unload(module_t *, vlc_deactivate_t deinit, ... );
> -
>   VLC_API module_t * module_need( vlc_object_t *, const char *, const char *, bool ) VLC_USED;
>   #define module_need(a,b,c,d) module_need(VLC_OBJECT(a),b,c,d)
>   
> diff --git a/include/vlc_objects.h b/include/vlc_objects.h
> index eaecdaa33b..0c9e055034 100644
> --- a/include/vlc_objects.h
> +++ b/include/vlc_objects.h
> @@ -231,9 +231,8 @@ static inline void vlc_object_release(vlc_object_t *o)
>    * when the module instance associated with the VLC object is terminated.
>    *
>    * Specifically, if the module instance activation/probe function fails, the
> - * resource will be freed immediately after the failure within
> - * vlc_module_load(). If the activation succeeds, the resource will be freed
> - * when the module instance is terminated with vlc_module_unload().
> + * resource will be freed immediately after the failure. If the activation
> + * succeeds, the resource will be freed when the module instance is terminated.
>    *
>    * This is a convenience mechanism to save explicit clean-up function calls
>    * in modules.
> diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> index 662ad6d3d3..c3f7dbbd1f 100644
> --- a/src/libvlccore.sym
> +++ b/src/libvlccore.sym
> @@ -258,7 +258,6 @@ module_need
>   module_provides
>   module_unneed
>   vlc_module_load
> -vlc_module_unload
>   vlc_memstream_open
>   vlc_memstream_flush
>   vlc_memstream_close
> diff --git a/src/modules/modules.c b/src/modules/modules.c
> index c8c19b1fd2..ac72e0fb26 100644
> --- a/src/modules/modules.c
> +++ b/src/modules/modules.c
> @@ -235,19 +235,6 @@ done:
>       return module;
>   }
>   
> -void vlc_module_unload(module_t *module, vlc_deactivate_t deinit, ...)
> -{
> -    if (module->pf_deactivate != NULL)
> -    {
> -        va_list ap;
> -
> -        va_start(ap, deinit);
> -        deinit(module->pf_deactivate, ap);
> -        va_end(ap);
> -    }
> -}
> -
> -
>   static int generic_start(void *func, bool forced, va_list ap)
>   {
>       vlc_object_t *obj = va_arg(ap, vlc_object_t *);
> -- 
> 2.22.0
> 
> _______________________________________________
> 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