summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/util.h b/util.h
index 273ece89f1..af39accc94 100644
--- a/util.h
+++ b/util.h
@@ -163,10 +163,14 @@ bool ignore_file(const char *filename);
} \
type name##_from_string(const char *s) { \
type i; \
+ unsigned u; \
assert(s); \
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
if (streq(name##_table[i], s)) \
return i; \
+ if (safe_atou(s, &u) >= 0 && \
+ u < ELEMENTSOF(name##_table)) \
+ return (type) u; \
return (type) -1; \
} \
struct __useless_struct_to_allow_trailing_semicolon__