Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb Don't specify string width in the low level function...



details:   https://anonhg.NetBSD.org/src/rev/6051e739f0c6
branches:  trunk
changeset: 543683:6051e739f0c6
user:      enami <enami%NetBSD.org@localhost>
date:      Sun Mar 02 13:39:40 2003 +0000

description:
Don't specify string width in the low level function like db_num_to_str.
The pretty printing should be done much higher level, and anyway the
value 10 doesn't make sense.

diffstat:

 sys/ddb/db_lex.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r 0382fa956bcc -r 6051e739f0c6 sys/ddb/db_lex.c
--- a/sys/ddb/db_lex.c  Sun Mar 02 13:26:22 2003 +0000
+++ b/sys/ddb/db_lex.c  Sun Mar 02 13:39:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_lex.c,v 1.16 2002/02/15 07:33:51 simonb Exp $       */
+/*     $NetBSD: db_lex.c,v 1.17 2003/03/02 13:39:40 enami Exp $        */
 
 /*
  * Mach Operating System
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.16 2002/02/15 07:33:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.17 2003/03/02 13:39:40 enami Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -136,6 +136,7 @@
 char *
 db_num_to_str(db_expr_t val)
 {
+
        /*
         * 2 chars for "0x", 1 for a sign ("-")
         * up to 21 chars for a 64-bit number:
@@ -147,12 +148,12 @@
        static char buf[25];
 
        if (db_radix == 16)
-               snprintf(buf, sizeof(buf), "%#10lx", val);
+               snprintf(buf, sizeof(buf), "%#lx", val);
        else if (db_radix == 8)
-               snprintf(buf, sizeof(buf), "%#10lo", val);
+               snprintf(buf, sizeof(buf), "%#lo", val);
        else
-               snprintf(buf, sizeof(buf), "%10lu", val);
-       return buf;
+               snprintf(buf, sizeof(buf), "%lu", val);
+       return (buf);
 }
 
 void



Home | Main Index | Thread Index | Old Index