summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 3a63351247..ba035caed0 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -8089,3 +8089,16 @@ int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
*p += k;
return 1;
}
+
+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;
+}