]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/string-table.c
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / src / basic / string-table.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3 This file is part of systemd.
4
5 Copyright 2010 Lennart Poettering
6 ***/
7
8 #include "string-table.h"
9 #include "string-util.h"
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 }