Source-Changes-HG archive

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

[src/trunk]: src/sys/arch fix fraction part of printing (from apb)



details:   https://anonhg.NetBSD.org/src/rev/82a0b446531e
branches:  trunk
changeset: 328107:82a0b446531e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 26 17:17:22 2014 +0000

description:
fix fraction part of printing (from apb)

diffstat:

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

diffs (66 lines):

diff -r 224dd0882307 -r 82a0b446531e sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Wed Mar 26 16:44:41 2014 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Wed Mar 26 17:17:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.252 2014/03/26 15:55:31 christos Exp $ */
+/*     $NetBSD: autoconf.c,v 1.253 2014/03/26 17:17:22 christos Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.252 2014/03/26 15:55:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.253 2014/03/26 17:17:22 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1039,11 +1039,9 @@
        freq /= 1000;
        len = snprintf(buf, sizeof(buf), "%d", freq / 1000);
        freq %= 1000;
-       if (freq) {
-               freq += 1000;   /* now in 1000..1999 */
-               snprintf(buf + len, sizeof(buf) - len, ".%d", freq);
-       }
-       return (buf);
+       if (freq)
+               snprintf(buf + len, sizeof(buf) - len, ".%03d", freq);
+       return buf;
 }
 
 /* ARGSUSED */
diff -r 224dd0882307 -r 82a0b446531e sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Wed Mar 26 16:44:41 2014 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Wed Mar 26 17:17:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.195 2014/03/26 15:55:31 christos Exp $ */
+/*     $NetBSD: autoconf.c,v 1.196 2014/03/26 17:17:22 christos Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.195 2014/03/26 15:55:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.196 2014/03/26 17:17:22 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -516,11 +516,9 @@
        freq /= 1000;
        len = snprintf(sbuf, sizeof(sbuf), "%ld", freq / 1000);
        freq %= 1000;
-       if (freq) {
-               freq += 1000;   /* now in 1000..1999 */
-               snprintf(sbuf + len, sizeof(sbuf) - len, ".%ld", freq);
-       }
-       return (sbuf);
+       if (freq)
+               snprintf(sbuf + len, sizeof(sbuf) - len, ".%03ld", freq);
+       return sbuf;
 }
 
 /* ARGSUSED */



Home | Main Index | Thread Index | Old Index