]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/string-table.c
hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX
[thirdparty/systemd.git] / src / basic / string-table.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "string-table.h"
4 #include "string-util.h"
5
6 ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) {
7 if (!key)
8 return -EINVAL;
9
10 for (size_t i = 0; i < len; ++i)
11 if (streq_ptr(table[i], key))
12 return (ssize_t) i;
13
14 return -EINVAL;
15 }