Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time Cleaner to use if/then/else rather than a ton ...
details: https://anonhg.NetBSD.org/src/rev/cdba7e526ae8
branches: trunk
changeset: 372242:cdba7e526ae8
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 02 12:49:10 2022 +0000
description:
Cleaner to use if/then/else rather than a ton of casts in the ternary operator.
diffstat:
lib/libc/time/zic.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 6c840d5db33d -r cdba7e526ae8 lib/libc/time/zic.c
--- a/lib/libc/time/zic.c Wed Nov 02 12:03:44 2022 +0000
+++ b/lib/libc/time/zic.c Wed Nov 02 12:49:10 2022 +0000
@@ -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 @@
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];
Home |
Main Index |
Thread Index |
Old Index