Module Name: src Committed By: christos Date: Wed Mar 26 17:29:21 UTC 2014
Modified Files: src/sys/arch/sparc/sparc: autoconf.c src/sys/arch/sparc64/sparc64: autoconf.c Log Message: use humanize_number per gimpy. To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/arch/sparc/sparc/autoconf.c cvs rdiff -u -r1.196 -r1.197 src/sys/arch/sparc64/sparc64/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/sparc/autoconf.c diff -u src/sys/arch/sparc/sparc/autoconf.c:1.253 src/sys/arch/sparc/sparc/autoconf.c:1.254 --- src/sys/arch/sparc/sparc/autoconf.c:1.253 Wed Mar 26 13:17:22 2014 +++ src/sys/arch/sparc/sparc/autoconf.c Wed Mar 26 13:29:21 2014 @@ -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 @@ char * 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 */ Index: src/sys/arch/sparc64/sparc64/autoconf.c diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.196 src/sys/arch/sparc64/sparc64/autoconf.c:1.197 --- src/sys/arch/sparc64/sparc64/autoconf.c:1.196 Wed Mar 26 13:17:22 2014 +++ src/sys/arch/sparc64/sparc64/autoconf.c Wed Mar 26 13:29:21 2014 @@ -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 @@ cpu_rootconf(void) 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 */