Source-Changes-HG archive

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

[src/trunk]: src/sys/arch use humanize_number per gimpy.



details:   https://anonhg.NetBSD.org/src/rev/3ea42525a943
branches:  trunk
changeset: 328108:3ea42525a943
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 26 17:29:21 2014 +0000

description:
use humanize_number per gimpy.

diffstat:

 sys/arch/sparc/sparc/autoconf.c     |  12 +++---------
 sys/arch/sparc64/sparc64/autoconf.c |  15 +++++----------
 2 files changed, 8 insertions(+), 19 deletions(-)

diffs (71 lines):

diff -r 82a0b446531e -r 3ea42525a943 sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Wed Mar 26 17:17:22 2014 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Wed Mar 26 17:29:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.253 2014/03/26 17:17:22 christos Exp $ */
+/*     $NetBSD: autoconf.c,v 1.254 2014/03/26 17:29:21 christos Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.253 2014/03/26 17:17:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.254 2014/03/26 17:29:21 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1034,14 +1034,8 @@
 clockfreq(int freq)
 {
        static char buf[10];
-       size_t len;
 
-       freq /= 1000;
-       len = snprintf(buf, sizeof(buf), "%d", freq / 1000);
-       freq %= 1000;
-       if (freq)
-               snprintf(buf + len, sizeof(buf) - len, ".%03d", freq);
-       return buf;
+       humanize_number(buf, sizeof(buf), freq / 1000, "", 1000);
 }
 
 /* ARGSUSED */
diff -r 82a0b446531e -r 3ea42525a943 sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Wed Mar 26 17:17:22 2014 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Wed Mar 26 17:29:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.196 2014/03/26 17:17:22 christos Exp $ */
+/*     $NetBSD: autoconf.c,v 1.197 2014/03/26 17:29:21 christos Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.196 2014/03/26 17:17:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.197 2014/03/26 17:29:21 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -510,15 +510,10 @@
 char *
 clockfreq(long freq)
 {
-       static char sbuf[10];
-       size_t len;
+       static char buf[10];
 
-       freq /= 1000;
-       len = snprintf(sbuf, sizeof(sbuf), "%ld", freq / 1000);
-       freq %= 1000;
-       if (freq)
-               snprintf(sbuf + len, sizeof(sbuf) - len, ".%03ld", freq);
-       return sbuf;
+       humanize_number(buf, sizeof(buf), freq / 1000, "", 1000);
+       return buf;
 }
 
 /* ARGSUSED */



Home | Main Index | Thread Index | Old Index