[vlc-devel] [PATCH] vlc_talloc: helper for table allocation

Thomas Guillem thomas at gllm.fr
Sat Nov 11 16:10:09 CET 2017


On Sat, Nov 11, 2017, at 16:07, RĂ©mi Denis-Courmont wrote:
> ---
>  include/vlc_common.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index 662248ceb3..4c16897cd3 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -844,6 +844,12 @@ VLC_API bool vlc_ureduce( unsigned *, unsigned *,
> uint64_t, uint64_t, uint64_t )
>  #define container_of(ptr, type, member) \
>      ((type *)(((char *)(ptr)) - offsetof(type, member)))
>  
> +VLC_USED VLC_MALLOC
> +static inline void *vlc_talloc(size_t count, size_t size)
> +{
> +    return likely(count * size <= size) ? malloc(count * size) : NULL;
> +}
> +

TG says LGTM.

>  /*****************************************************************************
>   * I18n stuff
>   *****************************************************************************/
> -- 
> 2.15.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