[FFmpeg-devel] [PATCH 1/2] avutil/common: Add FF_PTR_ADD()

Anton Khirnov anton at khirnov.net
Mon Mar 29 13:19:57 EEST 2021


Quoting Michael Niedermayer (2021-03-15 09:47:43)
> Suggested-by: Andreas Rheinhardt
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavutil/common.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavutil/common.h b/libavutil/common.h
> index aee353d399..c2d47a45b4 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -108,6 +108,8 @@
>  #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
>  #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
>  
> +#define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr))

IIUC Andreas suggested to either put an AV prefix on this or move it to
an internal header. I agree with that and prefer the latter, this macro
doesn't seem very useful for external callers.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list