Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ifconfig print the next parser name instead of just the...



details:   https://anonhg.NetBSD.org/src/rev/5249afe12fd1
branches:  trunk
changeset: 787987:5249afe12fd1
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jul 17 15:42:03 2013 +0000

description:
print the next parser name instead of just the pointer in debugging.

diffstat:

 sbin/ifconfig/parse.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r a86791921055 -r 5249afe12fd1 sbin/ifconfig/parse.c
--- a/sbin/ifconfig/parse.c     Wed Jul 17 15:40:42 2013 +0000
+++ b/sbin/ifconfig/parse.c     Wed Jul 17 15:42:03 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.17 2013/03/01 18:25:16 joerg Exp $ */
+/*     $NetBSD: parse.c,v 1.18 2013/07/17 15:42:03 christos Exp $      */
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: parse.c,v 1.17 2013/03/01 18:25:16 joerg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.18 2013/07/17 15:42:03 christos Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -49,7 +49,11 @@
 #include "parse.h"
 #include "util.h"
 
+#ifdef DEBUG
+#define dbg_warnx(__fmt, ...)  warnx(__fmt, __VA_ARGS__)
+#else
 #define dbg_warnx(__fmt, ...)  /* empty */
+#endif
 
 static int parser_default_init(struct parser *);
 static int pbranch_init(struct parser *);
@@ -568,9 +572,9 @@
        memset(&tmpm, 0, sizeof(tmpm));
 
        SIMPLEQ_FOREACH(b, &pb->pb_branches, b_next) {
-               dbg_warnx("%s: b->b_nextparser %p", __func__,
-                   (const void *)b->b_nextparser);
                nextp = b->b_nextparser;
+               dbg_warnx("%s: b->b_nextparser %p [%s]", __func__,
+                   nextp, nextp ? nextp->p_name : "(null)");
                if (nextp == NULL) {
                        if (arg == NULL) {
                                nmatch++;
@@ -766,8 +770,9 @@
                if ((b = malloc(sizeof(*b))) == NULL)
                        goto err;
                *b = brs[i];
-               dbg_warnx("%s: b->b_nextparser %p", __func__,
-                   (const void *)b->b_nextparser);
+               dbg_warnx("%s: b->b_nextparser %p [%s]", __func__,
+                   b->b_nextparser, b->b_nextparser ? b->b_nextparser->p_name
+                   : "(null)");
                SIMPLEQ_INSERT_TAIL(&pb->pb_branches, b, b_next);
        }
 



Home | Main Index | Thread Index | Old Index