|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 8507eb20b64010b26f23822cbf442bb0bf96511c Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Emil Renner Berthing <systemd@esmil.dk>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Fri, 19 Sep 2014 20:26:53 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] util: avoid non-portable __WORDSIZE
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
by any spec. Use explicit size comparisons if we're not interested in the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
WORDSIZE, anyway.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
(David: adjust commit message to explain why we do this)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/shared/util.h | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/shared/util.h b/src/shared/util.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index a1d5657237..21a90a40e5 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/shared/util.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/shared/util.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -205,7 +205,7 @@ int safe_atod(const char *s, double *ret_d);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int safe_atou8(const char *s, uint8_t *ret);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-#if __WORDSIZE == 32
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#if LONG_MAX == INT_MAX
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return safe_atou(s, (unsigned*) ret_u);
|