util-lib: move string table stuff into its own string-table.[ch]

This commit is contained in:
Lennart Poettering
2015-10-27 13:25:56 +01:00
parent 8fcde01280
commit 8b43440b7e
69 changed files with 215 additions and 96 deletions
+1 -13
View File
@@ -94,6 +94,7 @@
#include "random-util.h"
#include "signal-util.h"
#include "sparse-endian.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
@@ -1450,19 +1451,6 @@ int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
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;
}
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);