Module Name:    src
Committed By:   christos
Date:           Wed Nov  2 12:49:10 UTC 2022

Modified Files:
        src/lib/libc/time: zic.c

Log Message:
Cleaner to use if/then/else rather than a ton of casts in the ternary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/lib/libc/time/zic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.84 src/lib/libc/time/zic.c:1.85
--- src/lib/libc/time/zic.c:1.84	Sat Oct 29 09:55:50 2022
+++ src/lib/libc/time/zic.c	Wed Nov  2 08:49:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.84 2022/10/29 13:55:50 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.85 2022/11/02 12:49:10 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -11,7 +11,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.84 2022/10/29 13:55:50 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.85 2022/11/02 12:49:10 christos Exp $");
 #endif /* !defined lint */
 
 /* Use the system 'time' function, instead of any private replacement.
@@ -1204,7 +1204,10 @@ get_rand_u64(void)
       s = getrandom(entropy_buffer, sizeof entropy_buffer, 0);
     while (s < 0 && errno == EINTR);
 
-    nwords = s < 0 ? (size_t)-1 : s / sizeof *entropy_buffer;
+    if (s < 0)
+      nwords = -1;
+    else
+      nwords = s / sizeof *entropy_buffer;
   }
   if (0 < nwords)
     return entropy_buffer[--nwords];

Reply via email to