[PATCH 10/12] Right usage of DBG() vs debug()

Ondrej Zajicek santiago at crfreenet.org
Thu Oct 3 13:41:56 CEST 2013


On Mon, Sep 30, 2013 at 09:34:39PM +0300, Sergey Popovich wrote:
> Replace debug() calls with DBG() macro to call debug()
> only when building BIRD with GLOBAL_DEBUG or LOCAL_DEBUG.

This is not as it is supposed to be used. DBG() should be used where
debugging is controlled by debug macros, while debug() should be used
where it is user-requested, like in all dump commands.

So:

> diff --git a/filter/filter.c b/filter/filter.c
> index 3e8af1e..69cf579 100644
> --- a/filter/filter.c
> +++ b/filter/filter.c
> @@ -174,7 +174,7 @@ val_compare(struct f_val v1, struct f_val v2)
>        return uint_cmp(ipa_to_u32(v1.val.px.ip), v2.val.i);
>  #endif
>  -    debug( "Types do not match in val_compare\n" );
> +    DBG( "Types do not match in val_compare\n" );
>      return CMP_ERROR;
>    }
>    switch (v1.type) {
> @@ -797,7 +797,7 @@ interpret(struct f_inst *what)
>      res.type = T_BOOL;
>      break;
>    case '0':
> -    debug( "No operation\n" );
> +    DBG( "No operation\n" );
>      break;
>    case P('p',','):
>      ONEARG;
> @@ -1126,7 +1126,7 @@ interpret(struct f_inst *what)
>  	v1.type = T_VOID;
>  	t = find_tree(what->a2.p, v1);
>  	if (!t) {
> -	  debug( "No else statement?\n");
> +	  DBG( "No else statement?\n");
>  	  break;

These changes are OK, while

> diff --git a/lib/mempool.c b/lib/mempool.c
> index 65072f9..42418e9 100644
> --- a/lib/mempool.c
> +++ b/lib/mempool.c
> @@ -228,7 +228,7 @@ lp_dump(resource *r)
>      ;
>    for(cntl=0, c=m->first_large; c; c=c->next, cntl++)
>      ;
> -  debug("(chunk=%d threshold=%d count=%d+%d total=%d+%d)\n",
> +  DBG("(chunk=%d threshold=%d count=%d+%d total=%d+%d)\n",
>  	m->chunk_size,
>  	m->threshold,
>  	cnt,

These are not.

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20131003/88b17c0d/attachment.asc>


More information about the Bird-users mailing list