1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-28 05:57:33 +03:00

DEFINE_STRING_TABLE_LOOKUP: return _INVALID_* rather than assert on NULL string

This commit is contained in:
Tom Gundersen 2014-01-22 00:14:04 +01:00
parent 5d4795f372
commit 2c3d81d4a7

View File

@ -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)) \