chiark / gitweb /
test-compress-benchmark: fix argument parsing on 32bit
[elogind.git] / src / basic / parse-util.h
index 49184ecc38f4e34ba7db090cafe8e91639899c1d..9b1aebdb51d50da661a2c75c618196a3816a25a3 100644 (file)
@@ -93,6 +93,18 @@ static inline int safe_atoli(const char *s, long int *ret_u) {
 }
 #endif
 
+#if SIZE_MAX == UINT_MAX
+static inline int safe_atozu(const char *s, size_t *ret_u) {
+        assert_cc(sizeof(size_t) == sizeof(unsigned));
+        return safe_atou(s, ret_u);
+}
+#else
+static inline int safe_atozu(const char *s, size_t *ret_u) {
+        assert_cc(sizeof(size_t) == sizeof(long unsigned));
+        return safe_atolu(s, ret_u);
+}
+#endif
+
 int safe_atod(const char *s, double *ret_d);
 
 int parse_fractional_part_u(const char **s, size_t digits, unsigned *res);