2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2015-10-26 22:31:05 +01:00
|
|
|
|
|
|
|
#include "string-table.h"
|
2015-12-01 23:22:03 +01:00
|
|
|
#include "string-util.h"
|
2015-10-26 22:31:05 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|