Re: [PATCH] fix zlib debug in ppc boot header

From: Geert Uytterhoeven
Date: Wed Jul 28 2004 - 10:21:03 EST


On Wed, 28 Jul 2004, Olaf Hering wrote:
> @@ -85,16 +89,16 @@ extern char *z_errmsg[]; /* indexed by 1
>
> /* Diagnostic functions */
> #ifdef DEBUG_ZLIB
> -# include <stdio.h>
> +# include <nonstdio.h>
> # ifndef verbose
> # define verbose 0
> # endif
> -# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
> -# define Trace(x) fprintf x
> -# define Tracev(x) {if (verbose) fprintf x ;}
> -# define Tracevv(x) {if (verbose>1) fprintf x ;}
> -# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
> -# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
> +# define Assert(cond,msg) {if(!(cond)) printf(msg);}
> +# define Trace(x) printf x
> +# define Tracev(x) {if (verbose) printf x ;}
> +# define Tracevv(x) {if (verbose>1) printf x ;}
> +# define Tracec(c,x) {if (verbose && (c)) printf x ;}
> +# define Tracecv(c,x) {if (verbose>1 && (c)) printf x ;}
> #else
> # define Assert(cond,msg)
> # define Trace(x)
> @@ -311,7 +315,7 @@ int inflateReset(
> z->msg = Z_NULL;
> z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
> inflate_blocks_reset(z->state->blocks, z, &c);
> - Trace((stderr, "inflate: reset\n"));
> + Trace(("inflate: reset\n"));
> return Z_OK;
> }
>

Why don't you just define a fprintf() that throws away its first argument and
calls printf(), so you don't need to modify every caller of Trace*()?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/