Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Use bool where appropriate.



details:   https://anonhg.NetBSD.org/src/rev/e13165f2fe3a
branches:  trunk
changeset: 749895:e13165f2fe3a
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Dec 12 11:35:16 2009 +0000

description:
Use bool where appropriate.

diffstat:

 sys/kern/kern_todr.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (92 lines):

diff -r 9e505df4fd87 -r e13165f2fe3a sys/kern/kern_todr.c
--- a/sys/kern/kern_todr.c      Sat Dec 12 11:28:40 2009 +0000
+++ b/sys/kern/kern_todr.c      Sat Dec 12 11:35:16 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_todr.c,v 1.30 2009/12/12 11:28:40 tsutsui Exp $   */
+/*     $NetBSD: kern_todr.c,v 1.31 2009/12/12 11:35:16 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -76,7 +76,7 @@
  *     @(#)clock.c     8.1 (Berkeley) 6/10/93
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.30 2009/12/12 11:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.31 2009/12/12 11:35:16 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -103,7 +103,7 @@
        todr_handle = todr;
 }
 
-static int timeset = 0;
+static bool timeset = false;
 
 /*
  * Set up the system's time, given a `reasonable' time value.
@@ -111,7 +111,10 @@
 void
 inittodr(time_t base)
 {
-       int badbase = 0, waszero = (base == 0), goodtime = 0, badrtc = 0;
+       bool badbase = false;
+       bool waszero = (base == 0);
+       bool goodtime = false;
+       bool badrtc = false;
        int s;
        struct timespec ts;
        struct timeval tv;
@@ -133,7 +136,7 @@
                basedate.dt_min = 0;
                basedate.dt_sec = 0;
                base = clock_ymdhms_to_secs(&basedate);
-               badbase = 1;
+               badbase = true;
        }
 
        /*
@@ -150,14 +153,14 @@
                        printf("WARNING: preposterous TOD clock time\n");
                else
                        printf("WARNING: no TOD clock present\n");
-               badrtc = 1;
+               badrtc = true;
        } else {
                time_t deltat = tv.tv_sec - base;
 
                if (deltat < 0)
                        deltat = -deltat;
 
-               if ((badbase == 0) && deltat >= 2 * SECDAY) {
+               if (!badbase && deltat >= 2 * SECDAY) {
                        
                        if (tv.tv_sec < base) {
                                /*
@@ -168,14 +171,14 @@
                                 */
                                printf("WARNING: clock lost %" PRId64 " days\n",
                                    deltat / SECDAY);
-                               badrtc = 1;
+                               badrtc = true;
                        } else {
                                aprint_verbose("WARNING: clock gained %" PRId64
                                    " days\n", deltat / SECDAY);
-                               goodtime = 1;
+                               goodtime = true;
                        }
                } else {
-                       goodtime = 1;
+                       goodtime = true;
                }
        }
 
@@ -190,7 +193,7 @@
                tv.tv_usec = 0;
        }
 
-       timeset = 1;
+       timeset = true;
 
        ts.tv_sec = tv.tv_sec;
        ts.tv_nsec = tv.tv_usec * 1000;



Home | Main Index | Thread Index | Old Index