[FFmpeg-devel] [PATCH] Don't check for DEBUG before using dprintf.

Diego Biurrun diego
Tue Jan 25 01:55:42 CET 2011


On Tue, Jan 25, 2011 at 01:16:36AM +0100, Diego Elio Petten? wrote:
> From: Diego Elio 'Flameeyes' Petten? <flameeyes at gmail.com>
> 
> The dprintf macro is no-op when DEBUG is unset, so there is no need to
> put it conditional to DEBUG.
> 
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -84,7 +84,6 @@ static const char avi_headers[][8] = {
>  
> -#ifdef DEBUG
>  static void print_tag(const char *str, unsigned int tag, int size)
>  {
>      dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",
> @@ -94,7 +93,6 @@ static void print_tag(const char *str, unsigned int tag, int size)
>             (tag >> 24) & 0xff,
>             size);
>  }
> -#endif

The function does indeed only contain a dprintf call, but it is only
ever used conditional to DEBUG.  Thus removing the above #ifdef would
cause an unused function warning.

Possibly you can just remove those ifdefs from the print_tag calls, but
better doublecheck that the call is indeed optimized away.

Rest of the patch is OK.

Diego



More information about the ffmpeg-devel mailing list