chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
8e672b6
)
string-table: make sure DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() handles NULL string...
author
Lennart Poettering
<lennart@poettering.net>
Wed, 15 Jun 2016 20:25:48 +0000
(22:25 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:13:01 +0000
(10:13 +0200)
xyz_from_string() functions defined with DEFINE_STRING_TABLE_LOOKUP() properly
handle NULL strings already. make sure the equivalent functions defined with
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() do the same.
src/basic/string-table.h
patch
|
blob
|
history
diff --git
a/src/basic/string-table.h
b/src/basic/string-table.h
index d88625fca73664537766be2734798233a48678f5..369610efc8ca0c77ad4d7d591172f8c180662c01 100644
(file)
--- a/
src/basic/string-table.h
+++ b/
src/basic/string-table.h
@@
-48,6
+48,8
@@
ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) \
scope type name##_from_string(const char *s) { \
int b; \
+ if (!s) \
+ return -1; \
b = parse_boolean(s); \
if (b == 0) \
return (type) 0; \