chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
DEFINE_STRING_TABLE_LOOKUP: return _INVALID_* rather than assert on NULL string
[elogind.git]
/
src
/
shared
/
util.h
diff --git
a/src/shared/util.h
b/src/shared/util.h
index ebc765da35668e4759093d4dbfcbb700183b4819..d6d746bc6a506386b7a33f1902f07756a8356d78 100644
(file)
--- 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)) \