summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-22 00:14:04 +0100
committerTom Gundersen <teg@jklm.no>2014-01-22 17:56:49 +0100
commit2c3d81d4a7e3888632537140aae57940159fb39e (patch)
tree046b2611b9d7d745543a6634c5e5c0ddc0310176 /src/shared/util.h
parent5d4795f3722911ccd7953c0cf112c1f7624ea834 (diff)
DEFINE_STRING_TABLE_LOOKUP: return _INVALID_* rather than assert on NULL string
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index ebc765da35..d6d746bc6a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -295,7 +295,8 @@ static inline uint32_t random_u32(void) {
} \
scope type name##_from_string(const char *s) { \
type i; \
- assert(s); \
+ if (!s) \
+ return (type) -1; \
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
if (name##_table[i] && \
streq(name##_table[i], s)) \