[FFmpeg-devel] [PATCH] add FFARRAY_SIZE macro
Benoit Fouet
benoit.fouet
Mon Sep 29 20:03:09 CEST 2008
Hi Aurel,
Aurelien Jacobs a ?crit :
> Benoit Fouet wrote:
>
>
>> hi,
>>
>> patch to $subj attached
>>
>
> That's at least the third time such a patch is proposed. It seems to be
> a quite popular request :-)
> IIRC, last time this came up, Michael was not happy with the name of
> the macro. Well, another popular name for this macro is COUNTOF().
> So maybe attached patch would be acceptable ?
>
>
I don't care about the name...
> ------------------------------------------------------------------------
>
> Index: libavutil/common.h
> ===================================================================
> --- libavutil/common.h (revision 15461)
> +++ libavutil/common.h (working copy)
> @@ -116,6 +116,8 @@
> #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
>
> #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
> +
> +#define FFCOUNTOF(a) (sizeof(a) / sizeof(*a))
>
>
... but this should at least be sizeof(*(a)), or sizeof((a)[0])
--
Ben
More information about the ffmpeg-devel
mailing list