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

Sergey Popovich popovich_sergei at mail.ru
Mon Sep 30 20:34:39 CEST 2013


Replace debug() calls with DBG() macro to call debug()
only when building BIRD with GLOBAL_DEBUG or LOCAL_DEBUG.

Additionally fix build with GLOBAL_DEBUG enabled and
--with-protocols=all.
---
 TODO                  |    1 -
 filter/filter.c       |    6 +++---
 lib/event.c           |    2 +-
 lib/mempool.c         |    2 +-
 lib/resource.c        |   14 +++++++-------
 lib/slab.c            |    4 ++--
 nest/iface.c          |   30 +++++++++++++++---------------
 nest/locks.c          |    4 ++--
 nest/neighbor.c       |   16 ++++++++--------
 nest/proto.c          |   18 +++++++++---------
 nest/rt-attr.c        |   40 ++++++++++++++++++++--------------------
 nest/rt-fib.c         |   12 ++++++------
 nest/rt-table.c       |   12 ++++++------
 proto/ospf/neighbor.c |    2 +-
 proto/ospf/packet.c   |    2 +-
 proto/rip/rip.c       |   10 +++++-----
 proto/static/static.c |   12 ++++++------
 sysdep/unix/io.c      |   26 +++++++++++++-------------
 sysdep/unix/krt.c     |    4 ++--
 sysdep/unix/main.c    |    4 ++--
 20 files changed, 110 insertions(+), 111 deletions(-)

diff --git a/TODO b/TODO
index 23cd187..d9b6a20 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ Core
  Globals
 ~~~~~~~
-- right usage of DBG vs. debug
 - logging and tracing; use appropriate log levels
 - check incoming packets and log errors!!
 - check log calls for trailing newlines and log levels followed by comma
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;
 	}
       }	
diff --git a/lib/event.c b/lib/event.c
index 916cf55..f1703cb 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -39,7 +39,7 @@ ev_dump(resource *r)
 {
   event *e = (event *) r;
 -  debug("(code %p, data %p, %s)\n",
+  DBG("(code %p, data %p, %s)\n",
 	e->hook,
 	e->data,
 	e->n.next ? "scheduled" : "inactive");
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,
diff --git a/lib/resource.c b/lib/resource.c
index 42243aa..ae955a4 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -90,7 +90,7 @@ pool_dump(resource *P)
   pool *p = (pool *) P;
   resource *r;
 -  debug("%s\n", p->name);
+  DBG("%s\n", p->name);
   indent += 3;
   WALK_LIST(r, p->inside)
     rdump(r);
@@ -182,14 +182,14 @@ rdump(void *res)
   resource *r = res;
    bsprintf(x, "%%%ds%%p ", indent);
-  debug(x, "", r);
+  DBG(x, "", r);
   if (r)
     {
-      debug("%s ", r->class->name);
+      DBG("%s ", r->class->name);
       r->class->dump(r);
     }
   else
-    debug("NULL\n");
+    DBG("NULL\n");
 }
  size_t
@@ -240,11 +240,11 @@ rlookup(unsigned long a)
 {
   resource *r;
 -  debug("Looking up %08lx\n", a);
+  DBG("Looking up %08lx\n", a);
   if (r = pool_lookup(&root_pool.r, a))
     rdump(r);
   else
-    debug("Not found.\n");
+    DBG("Not found.\n");
 }
  /**
@@ -290,7 +290,7 @@ static void mbl_debug(resource *r)
 {
   struct mblock *m = (struct mblock *) r;
 -  debug("(size=%d)\n", m->size);
+  DBG("(size=%d)\n", m->size);
 }
  static resource *
diff --git a/lib/slab.c b/lib/slab.c
index e236e26..78d535f 100644
--- a/lib/slab.c
+++ b/lib/slab.c
@@ -116,7 +116,7 @@ slab_dump(resource *r)
    WALK_LIST(o, s->objs)
     cnt++;
-  debug("(%d objects per %d bytes)\n", cnt, s->size);
+  DBG("(%d objects per %d bytes)\n", cnt, s->size);
 }
  static size_t
@@ -339,7 +339,7 @@ slab_dump(resource *r)
     pc++;
   WALK_LIST(h, s->full_heads)
     fc++;
-  debug("(%de+%dp+%df blocks per %d objs per %d bytes)\n", ec, pc, fc,
s->objs_per_slab, s->obj_size);
+  DBG("(%de+%dp+%df blocks per %d objs per %d bytes)\n", ec, pc, fc,
s->objs_per_slab, s->obj_size);
 }
  static size_t
diff --git a/nest/iface.c b/nest/iface.c
index b4ab70c..c7050be 100644
--- a/nest/iface.c
+++ b/nest/iface.c
@@ -46,7 +46,7 @@ list iface_list;
 void
 ifa_dump(struct ifa *a)
 {
-  debug("\t%I, net %I/%-2d bc %I -> %I%s%s%s\n", a->ip, a->prefix,
a->pxlen, a->brd, a->opposite,
+  DBG("\t%I, net %I/%-2d bc %I -> %I%s%s%s\n", a->ip, a->prefix,
a->pxlen, a->brd, a->opposite,
 	(a->flags & IF_UP) ? "" : " DOWN",
 	(a->flags & IA_PRIMARY) ? "" : " SEC",
 	(a->flags & IA_PEER) ? "PEER" : "");
@@ -64,28 +64,28 @@ if_dump(struct iface *i)
 {
   struct ifa *a;
 -  debug("IF%d: %s", i->index, i->name);
+  DBG("IF%d: %s", i->index, i->name);
   if (i->flags & IF_SHUTDOWN)
-    debug(" SHUTDOWN");
+    DBG(" SHUTDOWN");
   if (i->flags & IF_UP)
-    debug(" UP");
+    DBG(" UP");
   else
-    debug(" DOWN");
+    DBG(" DOWN");
   if (i->flags & IF_ADMIN_UP)
-    debug(" LINK-UP");
+    DBG(" LINK-UP");
   if (i->flags & IF_MULTIACCESS)
-    debug(" MA");
+    DBG(" MA");
   if (i->flags & IF_BROADCAST)
-    debug(" BC");
+    DBG(" BC");
   if (i->flags & IF_MULTICAST)
-    debug(" MC");
+    DBG(" MC");
   if (i->flags & IF_LOOPBACK)
-    debug(" LOOP");
+    DBG(" LOOP");
   if (i->flags & IF_IGNORE)
-    debug(" IGN");
+    DBG(" IGN");
   if (i->flags & IF_TMP_DOWN)
-    debug(" TDOWN");
-  debug(" MTU=%d\n", i->mtu);
+    DBG(" TDOWN");
+  DBG(" MTU=%d\n", i->mtu);
   WALK_LIST(a, i->addrs)
     {
       ifa_dump(a);
@@ -104,10 +104,10 @@ if_dump_all(void)
 {
   struct iface *i;
 -  debug("Known network interfaces:\n");
+  DBG("Known network interfaces:\n");
   WALK_LIST(i, iface_list)
     if_dump(i);
-  debug("Router ID: %08x\n", config->router_id);
+  DBG("Router ID: %08x\n", config->router_id);
 }
  static inline unsigned
diff --git a/nest/locks.c b/nest/locks.c
index 7044d6a..ec7a3d6 100644
--- a/nest/locks.c
+++ b/nest/locks.c
@@ -88,9 +88,9 @@ olock_dump(resource *r)
   struct object_lock *l = (struct object_lock *) r;
   static char *olock_states[] = { "free", "locked", "waiting", "event" };
 -  debug("(%d:%s:%I:%d) [%s]\n", l->type, (l->iface ? l->iface->name :
"?"), l->addr, l->port, olock_states[l->state]);
+  DBG("(%d:%s:%I:%d) [%s]\n", l->type, (l->iface ? l->iface->name :
"?"), l->addr, l->port, olock_states[l->state]);
   if (!EMPTY_LIST(l->waiters))
-    debug(" [wanted]\n");
+    DBG(" [wanted]\n");
 }
  static struct resclass olock_class = {
diff --git a/nest/neighbor.c b/nest/neighbor.c
index 11a980b..feaee5d 100644
--- a/nest/neighbor.c
+++ b/nest/neighbor.c
@@ -183,15 +183,15 @@ neigh_find2(struct proto *p, ip_addr *a, struct
iface *ifa, unsigned flags)
 void
 neigh_dump(neighbor *n)
 {
-  debug("%p %I ", n, n->addr);
+  DBG("%p %I ", n, n->addr);
   if (n->iface)
-    debug("%s ", n->iface->name);
+    DBG("%s ", n->iface->name);
   else
-    debug("[] ");
-  debug("%s %p %08x scope %s", n->proto->name, n->data, n->aux,
ip_scope_text(n->scope));
+    DBG("[] ");
+  DBG("%s %p %08x scope %s", n->proto->name, n->data, n->aux,
ip_scope_text(n->scope));
   if (n->flags & NEF_STICKY)
-    debug(" STICKY");
-  debug("\n");
+    DBG(" STICKY");
+  DBG("\n");
 }
  /**
@@ -206,13 +206,13 @@ neigh_dump_all(void)
   neighbor *n;
   int i;
 -  debug("Known neighbors:\n");
+  DBG("Known neighbors:\n");
   WALK_LIST(n, sticky_neigh_list)
     neigh_dump(n);
   for(i=0; i<NEIGH_HASH_SIZE; i++)
     WALK_LIST(n, neigh_hash_table[i])
       neigh_dump(n);
-  debug("\n");
+  DBG("\n");
 }
  static void
diff --git a/nest/proto.c b/nest/proto.c
index 60495aa..f66449e 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -635,31 +635,31 @@ protos_dump_all(void)
   struct proto *p;
   struct announce_hook *a;
 -  debug("Protocols:\n");
+  DBG("Protocols:\n");
    WALK_LIST(p, active_proto_list)
     {
-      debug("  protocol %s state %s/%s\n", p->name,
+      DBG("  protocol %s state %s/%s\n", p->name,
 	    p_states[p->proto_state], c_states[p->core_state]);
       for (a = p->ahooks; a; a = a->next)
 	{
-	  debug("\tTABLE %s\n", a->table->name);
+	  DBG("\tTABLE %s\n", a->table->name);
 	  if (a->in_filter)
-	    debug("\tInput filter: %s\n", filter_name(a->in_filter));
+	    DBG("\tInput filter: %s\n", filter_name(a->in_filter));
 	  if (a->out_filter != FILTER_REJECT)
-	    debug("\tOutput filter: %s\n", filter_name(a->out_filter));
+	    DBG("\tOutput filter: %s\n", filter_name(a->out_filter));
 	}
       if (p->disabled)
-	debug("\tDISABLED\n");
+	DBG("\tDISABLED\n");
       else if (p->proto->dump)
 	p->proto->dump(p);
     }
   WALK_LIST(p, inactive_proto_list)
-    debug("  inactive %s: state %s/%s\n", p->name,
p_states[p->proto_state], c_states[p->core_state]);
+    DBG("  inactive %s: state %s/%s\n", p->name,
p_states[p->proto_state], c_states[p->core_state]);
   WALK_LIST(p, initial_proto_list)
-    debug("  initial %s\n", p->name);
+    DBG("  initial %s\n", p->name);
   WALK_LIST(p, flush_proto_list)
-    debug("  flushing %s\n", p->name);
+    DBG("  flushing %s\n", p->name);
 }
  /**
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 6aed318..64a6cc4 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -560,36 +560,36 @@ ea_dump(ea_list *e)
    if (!e)
     {
-      debug("NONE");
+      DBG("NONE");
       return;
     }
   while (e)
     {
-      debug("[%c%c%c]",
+      DBG("[%c%c%c]",
 	    (e->flags & EALF_SORTED) ? 'S' : 's',
 	    (e->flags & EALF_BISECT) ? 'B' : 'b',
 	    (e->flags & EALF_CACHED) ? 'C' : 'c');
       for(i=0; i<e->count; i++)
 	{
 	  eattr *a = &e->attrs[i];
-	  debug(" %02x:%02x.%02x", EA_PROTO(a->id), EA_ID(a->id), a->flags);
+	  DBG(" %02x:%02x.%02x", EA_PROTO(a->id), EA_ID(a->id), a->flags);
 	  if (a->type & EAF_TEMP)
-	    debug("T");
-	  debug("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
+	    DBG("T");
+	  DBG("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
 	  if (a->type & EAF_ORIGINATED)
-	    debug("o");
+	    DBG("o");
 	  if (a->type & EAF_EMBEDDED)
-	    debug(":%08x", a->u.data);
+	    DBG(":%08x", a->u.data);
 	  else
 	    {
 	      int j, len = a->u.ptr->length;
-	      debug("[%d]:", len);
+	      DBG("[%d]:", len);
 	      for(j=0; j<len; j++)
-		debug("%02x", a->u.ptr->data[j]);
+		DBG("%02x", a->u.ptr->data[j]);
 	    }
 	}
       if (e = e->next)
-	debug(" | ");
+	DBG(" | ");
     }
 }
 @@ -826,19 +826,19 @@ rta_dump(rta *a)
   static char *rtc[] = { "", " BC", " MC", " AC" };
   static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
 -  debug("p=%s uc=%d %s %s%s%s h=%04x",
+  DBG("p=%s uc=%d %s %s%s%s h=%04x",
 	a->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope),
rtc[a->cast],
 	rtd[a->dest], a->hash_key);
   if (!(a->aflags & RTAF_CACHED))
-    debug(" !CACHED");
-  debug(" <-%I", a->from);
+    DBG(" !CACHED");
+  DBG(" <-%I", a->from);
   if (a->dest == RTD_ROUTER)
-    debug(" ->%I", a->gw);
+    DBG(" ->%I", a->gw);
   if (a->dest == RTD_DEVICE || a->dest == RTD_ROUTER)
-    debug(" [%s]", a->iface ? a->iface->name : "???" );
+    DBG(" [%s]", a->iface ? a->iface->name : "???" );
   if (a->eattrs)
     {
-      debug(" EA: ");
+      DBG(" EA: ");
       ea_dump(a->eattrs);
     }
 }
@@ -855,15 +855,15 @@ rta_dump_all(void)
   rta *a;
   unsigned int h;
 -  debug("Route attribute cache (%d entries, rehash at %d):\n",
rta_cache_count, rta_cache_limit);
+  DBG("Route attribute cache (%d entries, rehash at %d):\n",
rta_cache_count, rta_cache_limit);
   for(h=0; h<rta_cache_size; h++)
     for(a=rta_hash_table[h]; a; a=a->next)
       {
-	debug("%p ", a);
+	DBG("%p ", a);
 	rta_dump(a);
-	debug("\n");
+	DBG("\n");
       }
-  debug("\n");
+  DBG("\n");
 }
  void
diff --git a/nest/rt-fib.c b/nest/rt-fib.c
index 510aa76..b6d5d06 100644
--- a/nest/rt-fib.c
+++ b/nest/rt-fib.c
@@ -491,21 +491,21 @@ void dump(char *m)
 {
   unsigned int i;
 -  debug("%s ... order=%d, size=%d, entries=%d\n", m, f.hash_order,
f.hash_size, f.hash_size);
+  DBG("%s ... order=%d, size=%d, entries=%d\n", m, f.hash_order,
f.hash_size, f.hash_size);
   for(i=0; i<f.hash_size; i++)
     {
       struct fib_node *n;
       struct fib_iterator *j;
       for(n=f.hash_table[i]; n; n=n->next)
 	{
-	  debug("%04x %04x %p %I/%2d", i, ipa_hash(n->prefix), n, n->prefix,
n->pxlen);
+	  DBG("%04x %04x %p %I/%2d", i, ipa_hash(n->prefix), n, n->prefix,
n->pxlen);
 	  for(j=n->readers; j; j=j->next)
-	    debug(" %p[%p]", j, j->node);
-	  debug("\n");
+	    DBG(" %p[%p]", j, j->node);
+	  DBG("\n");
 	}
     }
   fib_check(&f);
-  debug("-----\n");
+  DBG("-----\n");
 }
  void init(struct fib_node *n)
@@ -552,7 +552,7 @@ next:
 	  goto next;
 	}
       c = 1;
-      debug("got %p\n", z);
+      DBG("got %p\n", z);
     }
   FIB_ITERATE_END;
   dump("iter end");
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 16dd9bc..883cfb8 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -1106,12 +1106,12 @@ void
 rte_dump(rte *e)
 {
   net *n = e->net;
-  debug("%-1I/%2d ", n->n.prefix, n->n.pxlen);
-  debug("KF=%02x PF=%02x pref=%d lm=%d ", n->n.flags, e->pflags,
e->pref, now-e->lastmod);
+  DBG("%-1I/%2d ", n->n.prefix, n->n.pxlen);
+  DBG("KF=%02x PF=%02x pref=%d lm=%d ", n->n.flags, e->pflags, e->pref,
now-e->lastmod);
   rta_dump(e->attrs);
   if (e->attrs->proto->proto->dump_attrs)
     e->attrs->proto->proto->dump_attrs(e);
-  debug("\n");
+  DBG("\n");
 }
  /**
@@ -1127,7 +1127,7 @@ rt_dump(rtable *t)
   net *n;
   struct announce_hook *a;
 -  debug("Dump of routing table <%s>\n", t->name);
+  DBG("Dump of routing table <%s>\n", t->name);
 #ifdef DEBUGGING
   fib_check(&t->fib);
 #endif
@@ -1139,8 +1139,8 @@ rt_dump(rtable *t)
     }
   FIB_WALK_END;
   WALK_LIST(a, t->hooks)
-    debug("\tAnnounces routes to protocol %s\n", a->proto->name);
-  debug("\n");
+    DBG("\tAnnounces routes to protocol %s\n", a->proto->name);
+  DBG("\n");
 }
  /**
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index 26d81dc..c1f2a0b 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -619,7 +619,7 @@ static void
 rxmt_timer_hook(timer * timer)
 {
   struct ospf_neighbor *n = (struct ospf_neighbor *) timer->data;
-  // struct proto *p = &n->ifa->oa->po->proto;
+  struct proto *p = &n->ifa->oa->po->proto;
   struct top_hash_entry *en;
    DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n",
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index 4338bc1..fb02f68 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -268,7 +268,7 @@ ospf_rx_hook(sock *sk, int size)
   /* Initially, the packet is associated with the 'master' iface */
   struct ospf_iface *ifa = sk->data;
   struct proto_ospf *po = ifa->oa->po;
-  // struct proto *p = &po->proto;
+  struct proto *p = &po->proto;
    int src_local, dst_local UNUSED, dst_mcast;    src_local =
ipa_in_net(sk->faddr, ifa->addr->prefix, ifa->addr->pxlen);
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 3ec070b..9f49c6b 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -512,9 +512,9 @@ rip_rx(sock *s, int size)
 static void
 rip_dump_entry( struct rip_entry *e )
 {
-  debug( "%I told me %d/%d ago: to %I/%d go via %I, metric %d ", +
DBG( "%I told me %d/%d ago: to %I/%d go via %I, metric %d ",
e->whotoldme, e->updated-now, e->changed-now, e->n.prefix, e->n.pxlen,
e->nexthop, e->metric );
-  debug( "\n" );
+  DBG( "\n" );
 }
  /**
@@ -637,16 +637,16 @@ rip_dump(struct proto *p)
   CHK_MAGIC;
   WALK_LIST( w, P->connections ) {
     struct rip_connection *n = (void *) w;
-    debug( "RIP: connection #%d: %I\n", n->num, n->addr );
+    DBG( "RIP: connection #%d: %I\n", n->num, n->addr );
   }
   i = 0;
   FIB_WALK( &P->rtable, e ) {
-    debug( "RIP: entry #%d: ", i++ );
+    DBG( "RIP: entry #%d: ", i++ );
     rip_dump_entry( (struct rip_entry *)e );
   } FIB_WALK_END;
   i = 0;
   WALK_LIST( rif, P->interfaces ) {
-    debug( "RIP: interface #%d: %s, %I, busy = %x\n", i++,
rif->iface?rif->iface->name:"(dummy)", rif->sock->daddr, rif->busy );
+    DBG( "RIP: interface #%d: %s, %I, busy = %x\n", i++,
rif->iface?rif->iface->name:"(dummy)", rif->sock->daddr, rif->busy );
   }
 }
 diff --git a/proto/static/static.c b/proto/static/static.c
index 9eee820..041c6a0 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -304,17 +304,17 @@ static_neigh_notify(struct neighbor *n)
 static void
 static_dump_rt(struct static_route *r)
 {
-  debug("%-1I/%2d: ", r->net, r->masklen);
+  DBG("%-1I/%2d: ", r->net, r->masklen);
   switch (r->dest)
     {
     case RTD_ROUTER:
-      debug("via %I\n", r->via);
+      DBG("via %I\n", r->via);
       break;
     case RTD_DEVICE:
-      debug("dev %s\n", r->if_name);
+      DBG("dev %s\n", r->if_name);
       break;
     default:
-      debug("rtd %d\n", r->dest);
+      DBG("rtd %d\n", r->dest);
       break;
     }
 }
@@ -325,10 +325,10 @@ static_dump(struct proto *p)
   struct static_config *c = (void *) p->cf;
   struct static_route *r;
 -  debug("Independent static routes:\n");
+  DBG("Independent static routes:\n");
   WALK_LIST(r, c->other_routes)
     static_dump_rt(r);
-  debug("Device static routes:\n");
+  DBG("Device static routes:\n");
   WALK_LIST(r, c->iface_routes)
     static_dump_rt(r);
 }
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index fcf5dd1..6fa1cc8 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -70,7 +70,7 @@ rf_dump(resource *r)
 {
   struct rfile *a = (struct rfile *) r;
 -  debug("(FILE *%p)\n", a->f);
+  DBG("(FILE *%p)\n", a->f);
 }
  static struct resclass rf_class = {
@@ -190,15 +190,15 @@ tm_dump(resource *r)
 {
   timer *t = (timer *) r;
 -  debug("(code %p, data %p, ", t->hook, t->data);
+  DBG("(code %p, data %p, ", t->hook, t->data);
   if (t->randomize)
-    debug("rand %d, ", t->randomize);
+    DBG("rand %d, ", t->randomize);
   if (t->recurrent)
-    debug("recur %d, ", t->recurrent);
+    DBG("recur %d, ", t->recurrent);
   if (t->expires)
-    debug("expires in %d sec)\n", t->expires - now);
+    DBG("expires in %d sec)\n", t->expires - now);
   else
-    debug("inactive)\n");
+    DBG("inactive)\n");
 }
  static struct resclass tm_class = {
@@ -298,14 +298,14 @@ tm_dump_them(char *name, list *l)
   node *n;
   timer *t;
 -  debug("%s timers:\n", name);
+  DBG("%s timers:\n", name);
   WALK_LIST(n, *l)
     {
       t = SKIP_BACK(timer, n, n);
-      debug("%p ", t);
+      DBG("%p ", t);
       tm_dump(&t->r);
     }
-  debug("\n");
+  DBG("\n");
 }
  void
@@ -560,7 +560,7 @@ sk_dump(resource *r)
   sock *s = (sock *) r;
   static char *sk_type_names[] = { "TCP<", "TCP>", "TCP", "UDP",
"UDP/MC", "IP", "IP/MC", "MAGIC", "UNIX<", "UNIX", "DEL!" };
 -  debug("(%s, ud=%p, sa=%08x, sp=%d, da=%08x, dp=%d, tos=%d, ttl=%d,
if=%s)\n",
+  DBG("(%s, ud=%p, sa=%08x, sp=%d, da=%08x, dp=%d, tos=%d, ttl=%d,
if=%s)\n",
 	sk_type_names[s->type],
 	s->data,
 	s->saddr,
@@ -1527,14 +1527,14 @@ sk_dump_all(void)
   node *n;
   sock *s;
 -  debug("Open sockets:\n");
+  DBG("Open sockets:\n");
   WALK_LIST(n, sock_list)
     {
       s = SKIP_BACK(sock, n, n);
-      debug("%p ", s);
+      DBG("%p ", s);
       sk_dump(&s->r);
     }
-  debug("\n");
+  DBG("\n");
 }
  #undef ERR
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 6de6077..f3df5ba 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -551,14 +551,14 @@ krt_dump(struct proto *P)
    if (!KRT_CF->learn)
     return;
-  debug("KRT: Table of inheritable routes\n");
+  DBG("KRT: Table of inheritable routes\n");
   rt_dump(&p->krt_table);
 }
  static void
 krt_dump_attrs(rte *e)
 {
-  debug(" [m=%d,p=%d,t=%d]", e->u.krt.metric, e->u.krt.proto,
e->u.krt.type);
+  DBG(" [m=%d,p=%d,t=%d]", e->u.krt.metric, e->u.krt.proto, e->u.krt.type);
 }
  #endif
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index bd80ba2..740c3ac 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -50,7 +50,7 @@ static int debug_flag = 0;
 void
 async_dump(void)
 {
-  debug("INTERNAL STATE DUMP\n\n");
+  DBG("INTERNAL STATE DUMP\n\n");
    rdump(&root_pool);
   sk_dump_all();
@@ -61,7 +61,7 @@ async_dump(void)
   rt_dump_all();
   protos_dump_all();
 -  debug("\n");
+  DBG("\n");
 }
  /*
-- 
1.7.10.4



More information about the Bird-users mailing list