chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Transpose args in strv_fnmatch() to be more oo
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index f5fcebebe7a1c26028593ebd93446e5eefb2d4ad..ba035caed064315363af1f2358fb6a5b16f246ad 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-39,7
+39,7
@@
#include <linux/tiocl.h>
#include <termios.h>
#include <stdarg.h>
#include <linux/tiocl.h>
#include <termios.h>
#include <stdarg.h>
-#include <
sys/
poll.h>
+#include <poll.h>
#include <ctype.h>
#include <sys/prctl.h>
#include <sys/utsname.h>
#include <ctype.h>
#include <sys/prctl.h>
#include <sys/utsname.h>
@@
-8089,3
+8089,16
@@
int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
*p += k;
return 1;
}
*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;
+}