diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2019-01-25 11:24:41 +0100 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2019-01-25 11:24:41 +0100 |
| commit | bbae86d3d2997a853ca0365e8eb7a3ca7489ee09 (patch) | |
| tree | 1f7fa49b47ab13aea3effbe839559d221f6323b4 /shared/systemd/src/basic/string-table.c | |
| parent | 404ebe62622150e77e311777dff8617eb974e834 (diff) | |
New upstream version 1.15.2
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; +} |