diff options
| author | Michael Biebl <biebl@debian.org> | 2019-03-26 23:25:23 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-03-26 23:25:23 +0100 |
| commit | 9a6dcbf895f9da01768e64b73cec88c16157d91e (patch) | |
| tree | a359958930d731e9f1b59344642e10754419fe84 /shared/systemd/src/basic/string-table.c | |
| parent | 964ae8cc391520440cf5aa13e2b9cc34850ea6c2 (diff) | |
New upstream version 1.16.0 upstream/1.16.0
Diffstat (limited to 'shared/systemd/src/basic/string-table.c')
| -rw-r--r-- | shared/systemd/src/basic/string-table.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/shared/systemd/src/basic/string-table.c b/shared/systemd/src/basic/string-table.c new file mode 100644 index 00000000..14ae6308 --- /dev/null +++ b/shared/systemd/src/basic/string-table.c @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ + +#include "nm-sd-adapt-shared.h" + +#include "string-table.h" +#include "string-util.h" + +ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) { + size_t i; + + if (!key) + return -1; + + for (i = 0; i < len; ++i) + if (streq_ptr(table[i], key)) + return (ssize_t) i; + + return -1; +} |