summaryrefslogtreecommitdiff
path: root/lib/inet_ntop.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-10-10 13:36:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-10-10 13:36:53 -0700
commitfea1830d840868b6d5d66ee30bb56f322f109254 (patch)
tree783d1b8e1a73c20fa03c02acdb61115b7bec47da /lib/inet_ntop.c
parente9e556f53c74014cb122e8c7fd0405f40f7c9acb (diff)
downloadgnulib-fea1830d840868b6d5d66ee30bb56f322f109254.tar.gz
prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1)
Formerly the style was sometimes 2*X - 1, because the C standard was wrongly thought to disallow ?: in integral constant expressions. * lib/inet_ntop.c (verify_int_size): Rewrite 2*X-7 (!) to 4<=X?1:-1. * lib/signal.in.h (verify_NSIG_constraint): Rewrite 2*X-1 to X?1:-1. * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise. * lib/stdint.in.h (_verify_intmax_size): Likewise. * lib/time.in.h (struct __time_t_must_be_integral): Rewrite 2 * ((time_t) 1 / 2 == 0) - 1 to (time_t) 1; this suffices to verify that time_t cannot be floating.
Diffstat (limited to 'lib/inet_ntop.c')
-rw-r--r--lib/inet_ntop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 2251aaa056..6583a378d2 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -49,7 +49,7 @@
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-typedef int verify_int_size[2 * sizeof (int) - 7];
+typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
#if HAVE_IPV6