diff options
author | Tom Gundersen <teg@jklm.no> | 2014-01-22 00:14:04 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-01-22 17:56:49 +0100 |
commit | 2c3d81d4a7e3888632537140aae57940159fb39e (patch) | |
tree | 046b2611b9d7d745543a6634c5e5c0ddc0310176 /src/shared | |
parent | 5d4795f3722911ccd7953c0cf112c1f7624ea834 (diff) |
DEFINE_STRING_TABLE_LOOKUP: return _INVALID_* rather than assert on NULL string
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.h | 3 |
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)) \ |