chiark / gitweb /
util: avoid non-portable __WORDSIZE
authorEmil Renner Berthing <systemd@esmil.dk>
Fri, 19 Sep 2014 18:26:53 +0000 (20:26 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Mon, 22 Sep 2014 16:20:21 +0000 (18:20 +0200)
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

(David: adjust commit message to explain why we do this)

src/shared/util.h

index a1d5657237368803ef9c6ab8e781d3670ddff132..21a90a40e5b3e4391d9a9cd9212ebfc2701ee0e7 100644 (file)
@@ -205,7 +205,7 @@ int safe_atod(const char *s, double *ret_d);
 
 int safe_atou8(const char *s, uint8_t *ret);
 
 
 int safe_atou8(const char *s, uint8_t *ret);
 
-#if __WORDSIZE == 32
+#if LONG_MAX == INT_MAX
 static inline int safe_atolu(const char *s, unsigned long *ret_u) {
         assert_cc(sizeof(unsigned long) == sizeof(unsigned));
         return safe_atou(s, (unsigned*) ret_u);
 static inline int safe_atolu(const char *s, unsigned long *ret_u) {
         assert_cc(sizeof(unsigned long) == sizeof(unsigned));
         return safe_atou(s, (unsigned*) ret_u);