From 8c721f2bcb134de228ec98f5e27ce89d79a31b55 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 19 Sep 2015 00:50:34 +0200 Subject: util: clean-ups to enum parsers Never log when we fail due to OOM when translating enums, let the caller do that. Translating basic types like enums should be something where the caller logs, not the translatior functions. Return -1 when NULL is passed to all enum parser functions. The non-fallback versions of the enum translator calls already handle NULL as failure, instead of hitting an assert, and we should do this here, too. --- src/basic/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/basic/util.c') diff --git a/src/basic/util.c b/src/basic/util.c index 368b556229..65951f7552 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -6561,7 +6561,7 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k for (i = 0; i < len; ++i) if (streq_ptr(table[i], key)) - return (ssize_t)i; + return (ssize_t) i; return -1; } -- cgit v1.2.3-54-g00ecf