]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
8b43440b LP |
2 | /*** |
3 | This file is part of systemd. | |
4 | ||
5 | Copyright 2010 Lennart Poettering | |
8b43440b LP |
6 | ***/ |
7 | ||
8 | #include "string-table.h" | |
93cc7779 | 9 | #include "string-util.h" |
8b43440b LP |
10 | |
11 | ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) { | |
12 | size_t i; | |
13 | ||
14 | if (!key) | |
15 | return -1; | |
16 | ||
17 | for (i = 0; i < len; ++i) | |
18 | if (streq_ptr(table[i], key)) | |
19 | return (ssize_t) i; | |
20 | ||
21 | return -1; | |
22 | } |