summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 22:31:05 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:25:56 +0100
commit8b43440b7ef4b81c69c31de7ff820dc07a780254 (patch)
tree595e6dbbf92dc2bc4ae92e21e1c99b2d61146ac8
parent8fcde01280adcbd07e8205b91ac52b06305b6208 (diff)
util-lib: move string table stuff into its own string-table.[ch]
-rw-r--r--Makefile.am2
-rw-r--r--src/basic/cgroup-util.c1
-rw-r--r--src/basic/locale-util.c1
-rw-r--r--src/basic/log.c1
-rw-r--r--src/basic/rlimit-util.c1
-rw-r--r--src/basic/signal-util.c1
-rw-r--r--src/basic/smack-util.c1
-rw-r--r--src/basic/socket-util.c1
-rw-r--r--src/basic/string-table.c35
-rw-r--r--src/basic/string-table.h88
-rw-r--r--src/basic/unit-name.c5
-rw-r--r--src/basic/util.c14
-rw-r--r--src/basic/util.h56
-rw-r--r--src/basic/virt.c1
-rw-r--r--src/bus-proxyd/bus-xml-policy.c1
-rw-r--r--src/core/automount.c1
-rw-r--r--src/core/bus-policy.c1
-rw-r--r--src/core/busname.c1
-rw-r--r--src/core/cgroup.c1
-rw-r--r--src/core/execute.c1
-rw-r--r--src/core/failure-action.c5
-rw-r--r--src/core/job.c1
-rw-r--r--src/core/kill.c5
-rw-r--r--src/core/manager.c1
-rw-r--r--src/core/mount.c1
-rw-r--r--src/core/namespace.c1
-rw-r--r--src/core/path.c1
-rw-r--r--src/core/scope.c1
-rw-r--r--src/core/service.c1
-rw-r--r--src/core/show-status.c2
-rw-r--r--src/core/socket.c1
-rw-r--r--src/core/swap.c1
-rw-r--r--src/core/timer.c1
-rw-r--r--src/import/import-compress.c3
-rw-r--r--src/import/importd.c1
-rw-r--r--src/journal-remote/journal-remote.c1
-rw-r--r--src/journal/compress.c1
-rw-r--r--src/journal/coredump.c1
-rw-r--r--src/journal/journald-server.c1
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c1
-rw-r--r--src/libsystemd/sd-device/device-private.c1
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c7
-rw-r--r--src/login/logind-action.c11
-rw-r--r--src/login/logind-inhibit.c1
-rw-r--r--src/login/logind-session.c1
-rw-r--r--src/login/logind-user.c1
-rw-r--r--src/machine/machine.c1
-rw-r--r--src/network/networkctl.c1
-rw-r--r--src/network/networkd-link.c1
-rw-r--r--src/network/networkd-netdev-bond.c3
-rw-r--r--src/network/networkd-netdev-ipvlan.c3
-rw-r--r--src/network/networkd-netdev-macvlan.c3
-rw-r--r--src/network/networkd-netdev-tunnel.c1
-rw-r--r--src/network/networkd-netdev.c1
-rw-r--r--src/network/networkd-network.c1
-rw-r--r--src/network/networkd-util.c1
-rw-r--r--src/resolve/resolved-dns-packet.c9
-rw-r--r--src/resolve/resolved-dns-transaction.c1
-rw-r--r--src/resolve/resolved-manager.c1
-rw-r--r--src/rfkill/rfkill.c1
-rw-r--r--src/shared/architecture.c1
-rw-r--r--src/shared/condition.c1
-rw-r--r--src/shared/import-util.c1
-rw-r--r--src/shared/install.c1
-rw-r--r--src/shared/logs-show.c1
-rw-r--r--src/shared/machine-image.c1
-rw-r--r--src/tmpfiles/tmpfiles.c1
-rw-r--r--src/udev/net/ethtool-util.c8
-rw-r--r--src/udev/net/link-config.c1
69 files changed, 215 insertions, 96 deletions
diff --git a/Makefile.am b/Makefile.am
index 6f819cb9f2..56715f6351 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -823,6 +823,8 @@ libbasic_la_SOURCES = \
src/basic/locale-util.h \
src/basic/signal-util.c \
src/basic/signal-util.h \
+ src/basic/string-table.c \
+ src/basic/string-table.h \
src/basic/mempool.c \
src/basic/mempool.h \
src/basic/hashmap.c \
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 84aea8afb8..d416b0b41e 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -44,6 +44,7 @@
#include "process-util.h"
#include "set.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "unit-name.h"
#include "user-util.h"
diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
index 08da4b98c5..9db906316b 100644
--- a/src/basic/locale-util.c
+++ b/src/basic/locale-util.c
@@ -26,6 +26,7 @@
#include "locale-util.h"
#include "path-util.h"
#include "set.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
diff --git a/src/basic/log.c b/src/basic/log.c
index 2c0abdc0bd..dcb24cfab7 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -39,6 +39,7 @@
#include "process-util.h"
#include "signal-util.h"
#include "socket-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
index 7f9d63224d..2627c813fc 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
@@ -21,6 +21,7 @@
#include "missing.h"
#include "rlimit-util.h"
+#include "string-table.h"
#include "util.h"
int setrlimit_closest(int resource, const struct rlimit *rlim) {
diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c
index e5ac6317d4..8038bc891d 100644
--- a/src/basic/signal-util.c
+++ b/src/basic/signal-util.c
@@ -21,6 +21,7 @@
#include "parse-util.h"
#include "signal-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
index 5ada621ca3..a96fb5b594 100644
--- a/src/basic/smack-util.c
+++ b/src/basic/smack-util.c
@@ -27,6 +27,7 @@
#include "path-util.h"
#include "process-util.h"
#include "smack-util.h"
+#include "string-table.h"
#include "util.h"
#include "xattr-util.h"
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index c4af6aa941..71a52a840a 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -38,6 +38,7 @@
#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/basic/string-table.c b/src/basic/string-table.c
new file mode 100644
index 0000000000..a860324fc9
--- /dev/null
+++ b/src/basic/string-table.c
@@ -0,0 +1,35 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "string-table.h"
+
+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;
+}
diff --git a/src/basic/string-table.h b/src/basic/string-table.h
new file mode 100644
index 0000000000..51b6007214
--- /dev/null
+++ b/src/basic/string-table.h
@@ -0,0 +1,88 @@
+
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "macro.h"
+#include "parse-util.h"
+#include "string-util.h"
+
+ssize_t string_table_lookup(const char * const *table, size_t len, const char *key);
+
+/* For basic lookup tables with strictly enumerated entries */
+#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
+ scope const char *name##_to_string(type i) { \
+ if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
+ return NULL; \
+ return name##_table[i]; \
+ }
+
+#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
+ scope type name##_from_string(const char *s) { \
+ return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
+ }
+
+#define _DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \
+ _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
+ _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
+ struct __useless_struct_to_allow_trailing_semicolon__
+
+#define DEFINE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,static)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,static)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,static)
+
+/* For string conversions where numbers are also acceptable */
+#define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max) \
+ int name##_to_string_alloc(type i, char **str) { \
+ char *s; \
+ if (i < 0 || i > max) \
+ return -ERANGE; \
+ if (i < (type) ELEMENTSOF(name##_table)) { \
+ s = strdup(name##_table[i]); \
+ if (!s) \
+ return -ENOMEM; \
+ } else { \
+ if (asprintf(&s, "%i", i) < 0) \
+ return -ENOMEM; \
+ } \
+ *str = s; \
+ return 0; \
+ } \
+ type name##_from_string(const char *s) { \
+ type i; \
+ unsigned u = 0; \
+ if (!s) \
+ return (type) -1; \
+ for (i = 0; i < (type) ELEMENTSOF(name##_table); i++) \
+ if (streq_ptr(name##_table[i], s)) \
+ return i; \
+ if (safe_atou(s, &u) >= 0 && u <= max) \
+ return (type) u; \
+ return (type) -1; \
+ } \
+ struct __useless_struct_to_allow_trailing_semicolon__
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index c6ba9afb5a..43f52ce7c8 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -24,12 +24,13 @@
#include "bus-label.h"
#include "def.h"
+#include "hexdecoct.h"
#include "path-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
-#include "util.h"
#include "unit-name.h"
-#include "hexdecoct.h"
+#include "util.h"
#define VALID_CHARS \
DIGITS LETTERS \
diff --git a/src/basic/util.c b/src/basic/util.c
index 30691dea6b..0878adbfac 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -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);
diff --git a/src/basic/util.h b/src/basic/util.h
index 6c6920c2a4..d18b151d88 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -83,62 +83,6 @@ static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
-/* For basic lookup tables with strictly enumerated entries */
-#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
- scope const char *name##_to_string(type i) { \
- if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
- return NULL; \
- return name##_table[i]; \
- }
-
-ssize_t string_table_lookup(const char * const *table, size_t len, const char *key);
-
-#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
- scope type name##_from_string(const char *s) { \
- return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
- }
-
-#define _DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \
- _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
- _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
- struct __useless_struct_to_allow_trailing_semicolon__
-
-#define DEFINE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,static)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,static)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,static)
-
-/* For string conversions where numbers are also acceptable */
-#define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max) \
- int name##_to_string_alloc(type i, char **str) { \
- char *s; \
- if (i < 0 || i > max) \
- return -ERANGE; \
- if (i < (type) ELEMENTSOF(name##_table)) { \
- s = strdup(name##_table[i]); \
- if (!s) \
- return -ENOMEM; \
- } else { \
- if (asprintf(&s, "%i", i) < 0) \
- return -ENOMEM; \
- } \
- *str = s; \
- return 0; \
- } \
- type name##_from_string(const char *s) { \
- type i; \
- unsigned u = 0; \
- if (!s) \
- return (type) -1; \
- for (i = 0; i < (type) ELEMENTSOF(name##_table); i++) \
- if (streq_ptr(name##_table[i], s)) \
- return i; \
- if (safe_atou(s, &u) >= 0 && u <= max) \
- return (type) u; \
- return (type) -1; \
- } \
- struct __useless_struct_to_allow_trailing_semicolon__
-
bool fstype_is_network(const char *fstype);
#define xsprintf(buf, fmt, ...) \
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 9267a2730b..9076cf618f 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -25,6 +25,7 @@
#include "fileio.h"
#include "process-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/bus-proxyd/bus-xml-policy.c b/src/bus-proxyd/bus-xml-policy.c
index 56dcfeab62..cf922ef02f 100644
--- a/src/bus-proxyd/bus-xml-policy.c
+++ b/src/bus-proxyd/bus-xml-policy.c
@@ -27,6 +27,7 @@
#include "fileio.h"
#include "formats-util.h"
#include "set.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
diff --git a/src/core/automount.c b/src/core/automount.c
index 00911118e6..379f71f74a 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -45,6 +45,7 @@
#include "path-util.h"
#include "process-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "unit-name.h"
#include "unit.h"
diff --git a/src/core/bus-policy.c b/src/core/bus-policy.c
index 2490903a8c..7ad18fb28c 100644
--- a/src/core/bus-policy.c
+++ b/src/core/bus-policy.c
@@ -22,6 +22,7 @@
#include "bus-kernel.h"
#include "bus-policy.h"
#include "kdbus.h"
+#include "string-table.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/core/busname.c b/src/core/busname.c
index df4a8bef52..94674c99fa 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -34,6 +34,7 @@
#include "service.h"
#include "signal-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
static const UnitActiveState state_translation_table[_BUSNAME_STATE_MAX] = {
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 6ef0580fad..0d37e69cd9 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -30,6 +30,7 @@
#include "path-util.h"
#include "process-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#define CGROUP_CPU_QUOTA_PERIOD_USEC ((usec_t) 100 * USEC_PER_MSEC)
diff --git a/src/core/execute.c b/src/core/execute.c
index a9564386ba..f354216325 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -89,6 +89,7 @@
#include "selinux-util.h"
#include "signal-util.h"
#include "smack-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
diff --git a/src/core/failure-action.c b/src/core/failure-action.c
index 3412accf3e..c7c95984b7 100644
--- a/src/core/failure-action.c
+++ b/src/core/failure-action.c
@@ -23,10 +23,11 @@
#include <sys/reboot.h>
#include <linux/reboot.h>
-#include "bus-util.h"
#include "bus-error.h"
-#include "special.h"
+#include "bus-util.h"
#include "failure-action.h"
+#include "special.h"
+#include "string-table.h"
#include "terminal-util.h"
static void log_and_status(Manager *m, const char *message) {
diff --git a/src/core/job.c b/src/core/job.c
index 7fde88f5fe..44532d0d5a 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -34,6 +34,7 @@
#include "parse-util.h"
#include "set.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
diff --git a/src/core/kill.c b/src/core/kill.c
index bddfa4460f..1466d5ce64 100644
--- a/src/core/kill.c
+++ b/src/core/kill.c
@@ -19,9 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "util.h"
-#include "signal-util.h"
#include "kill.h"
+#include "signal-util.h"
+#include "string-table.h"
+#include "util.h"
void kill_context_init(KillContext *c) {
assert(c);
diff --git a/src/core/manager.c b/src/core/manager.c
index 51e8b0566f..83068af77e 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -73,6 +73,7 @@
#include "signal-util.h"
#include "special.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
diff --git a/src/core/mount.c b/src/core/mount.c
index 9d8b55da58..f04f386930 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -41,6 +41,7 @@
#include "smack-util.h"
#include "special.h"
#include "string-util.h"
+#include "string-table.h"
#include "strv.h"
#include "unit-name.h"
#include "unit.h"
diff --git a/src/core/namespace.c b/src/core/namespace.c
index e6c381800b..ec7180ebdc 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -38,6 +38,7 @@
#include "path-util.h"
#include "selinux-util.h"
#include "socket-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/core/path.c b/src/core/path.c
index efd97d44eb..761ec265b4 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -33,6 +33,7 @@
#include "path.h"
#include "special.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "unit-name.h"
#include "unit.h"
diff --git a/src/core/scope.c b/src/core/scope.c
index 9f72851382..13de02cf16 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -26,6 +26,7 @@
#include "load-dropin.h"
#include "log.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
diff --git a/src/core/service.c b/src/core/service.c
index bb77f4502d..54a420d6f0 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -46,6 +46,7 @@
#include "service.h"
#include "signal-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
diff --git a/src/core/show-status.c b/src/core/show-status.c
index 9e4c9f563e..9509b21ccb 100644
--- a/src/core/show-status.c
+++ b/src/core/show-status.c
@@ -19,9 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "fd-util.h"
#include "parse-util.h"
#include "show-status.h"
#include "string-util.h"
+#include "terminal-util.h"
#include "util.h"
int parse_show_status(const char *v, ShowStatus *ret) {
diff --git a/src/core/socket.c b/src/core/socket.c
index 8ea7bd9af4..c145aa6081 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -50,6 +50,7 @@
#include "smack-util.h"
#include "socket.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
diff --git a/src/core/swap.c b/src/core/swap.c
index c4151c6afd..cb2da1cb5c 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -35,6 +35,7 @@
#include "parse-util.h"
#include "path-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "swap.h"
#include "udev-util.h"
diff --git a/src/core/timer.c b/src/core/timer.c
index 26d94eb521..47e501815a 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -27,6 +27,7 @@
#include "fs-util.h"
#include "parse-util.h"
#include "special.h"
+#include "string-table.h"
#include "string-util.h"
#include "timer.h"
#include "unit-name.h"
diff --git a/src/import/import-compress.c b/src/import/import-compress.c
index d6b8133036..d4ff178f60 100644
--- a/src/import/import-compress.c
+++ b/src/import/import-compress.c
@@ -19,8 +19,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "util.h"
#include "import-compress.h"
+#include "string-table.h"
+#include "util.h"
void import_compress_free(ImportCompress *c) {
assert(c);
diff --git a/src/import/importd.c b/src/import/importd.c
index 975907e3c9..2a03507d3a 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -37,6 +37,7 @@
#include "process-util.h"
#include "signal-util.h"
#include "socket-util.h"
+#include "string-table.h"
#include "strv.h"
#include "util.h"
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index b53b2abd76..dc87b21020 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -48,6 +48,7 @@
#include "signal-util.h"
#include "socket-util.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/journal/compress.c b/src/journal/compress.c
index 9308e8b789..196d6ff425 100644
--- a/src/journal/compress.c
+++ b/src/journal/compress.c
@@ -39,6 +39,7 @@
#include "journal-def.h"
#include "macro.h"
#include "sparse-endian.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 1756a823a9..257a665819 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -53,6 +53,7 @@
#include "process-util.h"
#include "special.h"
#include "stacktrace.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index a474293a87..ab213f705d 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -62,6 +62,7 @@
#include "selinux-util.h"
#include "signal-util.h"
#include "socket-util.h"
+#include "string-table.h"
#include "string-util.h"
#define USER_JOURNALS_MAX 1024
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index ade1b470d4..559c5e4df4 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -33,6 +33,7 @@
#include "fd-util.h"
#include "network-internal.h"
#include "random-util.h"
+#include "string-table.h"
#include "util.h"
#define MAX_MAC_ADDR_LEN INFINIBAND_ALEN
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index da325c9d28..daed321bd8 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -37,6 +37,7 @@
#include "path-util.h"
#include "refcnt.h"
#include "set.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index 4a5340e659..cf0a6248d6 100644
--- a/src/libsystemd/sd-netlink/netlink-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -28,16 +28,15 @@
#include <linux/if_bridge.h>
#include <linux/if_addr.h>
#include <linux/if.h>
-
#include <linux/ip.h>
#include <linux/if_link.h>
#include <linux/if_tunnel.h>
#include "macro.h"
-#include "util.h"
-
-#include "netlink-types.h"
#include "missing.h"
+#include "netlink-types.h"
+#include "string-table.h"
+#include "util.h"
/* Maximum ARP IP target defined in kernel */
#define BOND_MAX_ARP_TARGETS 16
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index f06f8edc07..8c452456a0 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -21,14 +21,15 @@
#include <unistd.h>
-#include "conf-parser.h"
-#include "special.h"
-#include "sleep-config.h"
-#include "bus-util.h"
#include "bus-error.h"
-#include "logind-action.h"
+#include "bus-util.h"
+#include "conf-parser.h"
#include "formats-util.h"
+#include "logind-action.h"
#include "process-util.h"
+#include "sleep-config.h"
+#include "special.h"
+#include "string-table.h"
#include "terminal-util.h"
#include "user-util.h"
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 460c2f0bd8..92b5807094 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -31,6 +31,7 @@
#include "logind-inhibit.h"
#include "mkdir.h"
#include "parse-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 9651d3e24a..829b614509 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -43,6 +43,7 @@
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
+#include "string-table.h"
#include "terminal-util.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 925190b603..9692a86709 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -43,6 +43,7 @@
#include "rm-rf.h"
#include "smack-util.h"
#include "special.h"
+#include "string-table.h"
#include "unit-name.h"
#include "util.h"
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 7aff55b761..2889cb3205 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -37,6 +37,7 @@
#include "mkdir.h"
#include "parse-util.h"
#include "special.h"
+#include "string-table.h"
#include "terminal-util.h"
#include "unit-name.h"
#include "util.h"
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index be679acca0..6ea9563fcf 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -39,6 +39,7 @@
#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
+#include "string-table.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 1144c82c17..de49fd5c22 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -33,6 +33,7 @@
#include "networkd-netdev.h"
#include "set.h"
#include "socket-util.h"
+#include "string-table.h"
#include "udev-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c
index afc1efdcf7..ce9c18d654 100644
--- a/src/network/networkd-netdev-bond.c
+++ b/src/network/networkd-netdev-bond.c
@@ -27,8 +27,9 @@
#include "conf-parser.h"
#include "missing.h"
-#include "string-util.h"
#include "networkd-netdev-bond.h"
+#include "string-util.h"
+#include "string-table.h"
/*
* Number of seconds between instances where the bonding
diff --git a/src/network/networkd-netdev-ipvlan.c b/src/network/networkd-netdev-ipvlan.c
index fb0aed0dcb..27cb7d1bf0 100644
--- a/src/network/networkd-netdev-ipvlan.c
+++ b/src/network/networkd-netdev-ipvlan.c
@@ -21,8 +21,9 @@
#include <net/if.h>
-#include "networkd-netdev-ipvlan.h"
#include "conf-parser.h"
+#include "networkd-netdev-ipvlan.h"
+#include "string-table.h"
static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
[NETDEV_IPVLAN_MODE_L2] = "L2",
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index e17de793ce..7144823b2d 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -21,8 +21,9 @@
#include <net/if.h>
-#include "networkd-netdev-macvlan.h"
#include "conf-parser.h"
+#include "networkd-netdev-macvlan.h"
+#include "string-table.h"
static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
[NETDEV_MACVLAN_MODE_PRIVATE] = "private",
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index 2dd16be381..385338849f 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -32,6 +32,7 @@
#include "networkd-link.h"
#include "networkd-netdev-tunnel.h"
#include "parse-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 0ed52a8d68..5060888a2f 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -31,6 +31,7 @@
#include "networkd.h"
#include "siphash24.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = {
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index eeb03df517..c8c6f5df11 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -32,6 +32,7 @@
#include "networkd.h"
#include "parse-util.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c
index 3ada0ce32b..17165266ef 100644
--- a/src/network/networkd-util.c
+++ b/src/network/networkd-util.c
@@ -22,6 +22,7 @@
#include "conf-parser.h"
#include "networkd-util.h"
#include "parse-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index bebd1ee4a6..f7f936d343 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -19,12 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "utf8.h"
-#include "util.h"
-#include "strv.h"
-#include "unaligned.h"
#include "dns-domain.h"
#include "resolved-dns-packet.h"
+#include "string-table.h"
+#include "strv.h"
+#include "unaligned.h"
+#include "utf8.h"
+#include "util.h"
int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
DnsPacket *p;
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index 84472ca1bc..1e38547e23 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -26,6 +26,7 @@
#include "random-util.h"
#include "resolved-dns-transaction.h"
#include "resolved-llmnr.h"
+#include "string-table.h"
DnsTransaction* dns_transaction_free(DnsTransaction *t) {
DnsQuery *q;
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index a6aac196db..b9c625b9cf 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -40,6 +40,7 @@
#include "resolved-llmnr.h"
#include "resolved-manager.h"
#include "socket-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "utf8.h"
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 559a176535..c08b746f2c 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -31,6 +31,7 @@
#include "io-util.h"
#include "mkdir.h"
#include "parse-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
diff --git a/src/shared/architecture.c b/src/shared/architecture.c
index e5efcd77b6..e2efa4272b 100644
--- a/src/shared/architecture.c
+++ b/src/shared/architecture.c
@@ -21,6 +21,7 @@
#include <sys/utsname.h>
+#include "string-table.h"
#include "string-util.h"
#include "architecture.h"
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 1c4c9419d0..a79a74eaa5 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -42,6 +42,7 @@
#include "selinux-util.h"
#include "smack-util.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/shared/import-util.c b/src/shared/import-util.c
index b50e86b944..bf5395dee8 100644
--- a/src/shared/import-util.c
+++ b/src/shared/import-util.c
@@ -22,6 +22,7 @@
#include "btrfs-util.h"
#include "import-util.h"
#include "path-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/shared/install.c b/src/shared/install.c
index df381358f8..1f63ae9ce0 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -39,6 +39,7 @@
#include "set.h"
#include "special.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 3519323b7a..5b4a220e5f 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -35,6 +35,7 @@
#include "logs-show.h"
#include "parse-util.h"
#include "process-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "terminal-util.h"
#include "utf8.h"
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 3f12a67b54..a4e77fb8d8 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -33,6 +33,7 @@
#include "mkdir.h"
#include "path-util.h"
#include "rm-rf.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 3b9fdf4378..9440ce7bb6 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -62,6 +62,7 @@
#include "set.h"
#include "specifier.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c
index a4b05d1bec..0647008d90 100644
--- a/src/udev/net/ethtool-util.c
+++ b/src/udev/net/ethtool-util.c
@@ -19,17 +19,17 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/ioctl.h>
#include <net/if.h>
+#include <sys/ioctl.h>
#include <linux/ethtool.h>
#include <linux/sockios.h>
+#include "conf-parser.h"
#include "ethtool-util.h"
-
+#include "log.h"
+#include "string-table.h"
#include "strxcpyx.h"
#include "util.h"
-#include "log.h"
-#include "conf-parser.h"
static const char* const duplex_table[_DUP_MAX] = {
[DUP_FULL] = "full",
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index b4807dc0f7..db4fe0c855 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -38,6 +38,7 @@
#include "path-util.h"
#include "random-util.h"
#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"