]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
8b43440b LP |
2 | |
3 | #include "string-table.h" | |
93cc7779 | 4 | #include "string-util.h" |
8b43440b LP |
5 | |
6 | ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) { | |
8b43440b LP |
7 | if (!key) |
8 | return -1; | |
9 | ||
6b9f5f01 | 10 | for (size_t i = 0; i < len; ++i) |
8b43440b LP |
11 | if (streq_ptr(table[i], key)) |
12 | return (ssize_t) i; | |
13 | ||
14 | return -1; | |
15 | } |