]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
string-table: Move more implementation logic into functions
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 3 May 2025 15:59:19 +0000 (17:59 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 6 May 2025 08:14:24 +0000 (10:14 +0200)
Let's move some more implementation logic into functions. We keep
the logic that requires the macro in the macro and move the rest into
functions.

While we're at it, let's also make the parameter declarations of
all the string table macros less clausthrophobic.

30 files changed:
src/basic/confidential-virt.c
src/basic/rlimit-util.c
src/basic/string-table.c
src/basic/string-table.h
src/basic/time-util.c
src/basic/virt.c
src/core/kill.c
src/core/scope.c
src/creds/creds.c
src/home/homed-home.c
src/import/import-compress.c
src/journal-remote/journal-remote-main.c
src/journal/journalctl.c
src/libsystemd/sd-journal/journal-file.c
src/libsystemd/sd-json/sd-json.c
src/network/netdev/macsec.c
src/network/networkd-link.c
src/repart/repart.c
src/shared/ask-password-api.c
src/shared/bootspec.c
src/shared/bpf-program.c
src/shared/coredump-util.c
src/shared/ethtool-util.c
src/shared/exec-util.c
src/shared/firewall-util-nft.c
src/shared/numa-util.c
src/shared/parse-argument.c
src/shared/pe-binary.c
src/systemctl/systemctl.c
src/sysupdate/sysupdated.c

index bb8953bba4cc4a494e52d7aedc05315414e997c6..9ca213f30d4dcec03894da696c396d2061f8df79 100644 (file)
@@ -16,6 +16,7 @@
 #include "fileio.h"
 #include "log.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "utf8.h"
 
 #if defined(__x86_64__)
index 0032f23c2646a92968da7844faab7952e7ba4f33..d5763b5f9e28a70aad38b804520fe764c1c932f8 100644 (file)
@@ -10,6 +10,7 @@
 #include "format-util.h"
 #include "log.h"
 #include "macro.h"
+#include "parse-util.h"
 #include "process-util.h"
 #include "rlimit-util.h"
 #include "string-table.h"
index 3a6376714a43ca3dd9d58ab1d7873a1f8b70c4e3..8f2b4cb15b20b40d8b7a855ed1610e59ce80e9a8 100644 (file)
@@ -1,9 +1,17 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "parse-util.h"
 #include "string-table.h"
 #include "string-util.h"
 
-ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) {
+const char* string_table_lookup_to_string(const char * const *table, size_t len, ssize_t i) {
+        if (i < 0 || i >= (ssize_t) len)
+                return NULL;
+
+        return table[i];
+}
+
+ssize_t string_table_lookup_from_string(const char * const *table, size_t len, const char *key) {
         if (!key)
                 return -EINVAL;
 
@@ -13,3 +21,49 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
 
         return -EINVAL;
 }
+
+ssize_t string_table_lookup_from_string_with_boolean(const char * const *table, size_t len, const char *key, ssize_t yes) {
+        if (!key)
+                return -EINVAL;
+
+        int b = parse_boolean(key);
+        if (b == 0)
+                return 0;
+        if (b > 0)
+                return yes;
+
+        return string_table_lookup_from_string(table, len, key);
+}
+
+int string_table_lookup_to_string_fallback(const char * const *table, size_t len, ssize_t i, size_t max, char **ret) {
+        char *s;
+
+        if (i < 0 || i > (ssize_t) max)
+                return -ERANGE;
+        if (i < (ssize_t) len && table[i]) {
+                s = strdup(table[i]);
+                if (!s)
+                        return -ENOMEM;
+        } else if (asprintf(&s, "%zd", i) < 0)
+                return -ENOMEM;
+
+        *ret = s;
+        return 0;
+}
+
+ssize_t string_table_lookup_from_string_fallback(const char * const *table, size_t len, const char *s, size_t max) {
+        unsigned u = 0;
+
+        if (!s)
+                return -EINVAL;
+
+        ssize_t i = string_table_lookup_from_string(table, len, s);
+        if (i >= 0)
+                return i;
+        if (safe_atou(s, &u) < 0)
+                return -EINVAL;
+        if (u > max)
+                return -EINVAL;
+
+        return u;
+}
index 83891eeb738910f02ab1aae56532822a831cd373..a1a966beef5b5125aa3a794dcedb582401fdb7f1 100644 (file)
 
 #pragma once
 
-#include <errno.h>
 #include <stddef.h>
 #include <stdio.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);
+const char* string_table_lookup_to_string(const char * const *table, size_t len, ssize_t i);
+
+ssize_t string_table_lookup_from_string(const char * const *table, size_t len, const char *key);
+
+ssize_t string_table_lookup_from_string_with_boolean(const char * const *table, size_t len, const char *key, ssize_t yes);
+
+int string_table_lookup_to_string_fallback(const char * const *table, size_t len, ssize_t i, size_t max, char **ret);
+
+ssize_t string_table_lookup_from_string_fallback(const char * const *table, size_t len, const char *s, size_t max);
 
 /* 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_TO_STRING(name, type, scope) \
+        scope const char* name##_to_string(type i) {             \
+                return string_table_lookup_to_string(name##_table, ELEMENTSOF(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_FROM_STRING(name, type, scope) \
+        scope type name##_from_string(const char *s) {             \
+                return (type) string_table_lookup_from_string(name##_table, ELEMENTSOF(name##_table), s); \
         }
 
-#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) \
-        scope type name##_from_string(const char *s) {                  \
-                if (!s)                                                 \
-                        return -EINVAL;                                 \
-                int b = parse_boolean(s);                               \
-                if (b == 0)                                             \
-                        return (type) 0;                                \
-                if (b > 0)                                              \
-                        return yes;                                     \
-                return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
+#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name, type, yes, scope) \
+        scope type name##_from_string(const char *s) {                               \
+                return (type) string_table_lookup_from_string_with_boolean(name##_table, ELEMENTSOF(name##_table), s, yes); \
         }
 
-#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,scope) \
-        scope int name##_to_string_alloc(type i, char **str) {          \
-                char *s;                                                \
-                if (i < 0 || i > max)                                   \
-                        return -ERANGE;                                 \
-                if (i < (type) ELEMENTSOF(name##_table) && name##_table[i]) { \
-                        s = strdup(name##_table[i]);                    \
-                        if (!s)                                         \
-                                return -ENOMEM;                         \
-                } else if (asprintf(&s, "%i", i) < 0)                   \
-                        return -ENOMEM;                                 \
-                *str = s;                                               \
-                return 0;                                               \
+#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max, scope) \
+        scope int name##_to_string_alloc(type i, char **ret) {                 \
+                return string_table_lookup_to_string_fallback(name##_table, ELEMENTSOF(name##_table), i, max, ret); \
         }
 
-#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,scope) \
-        scope type name##_from_string(const char *s) {                  \
-                unsigned u = 0;                                         \
-                type i;                                                 \
-                if (!s)                                                 \
-                        return -EINVAL;                                 \
-                i = (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
-                if (i >= 0)                                             \
-                        return i;                                       \
-                if (safe_atou(s, &u) < 0)                               \
-                        return -EINVAL;                                 \
-                if (u > max)                                            \
-                        return -EINVAL;                                 \
-                return (type) u;                                        \
+#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name, type, max, scope) \
+        scope type name##_from_string(const char *s) {                           \
+                return (type) string_table_lookup_from_string_fallback(name##_table, ELEMENTSOF(name##_table), s, max); \
         }
 
-#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)
+#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)
 
-#define _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,scope)   \
-        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope)          \
-        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope)
+#define _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name, type, yes, scope)  \
+        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type, scope)          \
+        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name, type, yes, scope)
 
-#define DEFINE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,)
-#define DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,)
-#define DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(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)
+#define DEFINE_STRING_TABLE_LOOKUP(name, type) _DEFINE_STRING_TABLE_LOOKUP(name, type,)
+#define DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type) _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type,)
+#define DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name, type) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(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)
 
-#define DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes) _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes) _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,static)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes) \
-        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,static)
+#define DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name, type, yes) _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name, type, yes,)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name, type, yes) _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name, type, yes, static)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name, type, yes) \
+        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name, type, yes, static)
 
 /* For string conversions where numbers are also acceptable */
-#define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max)         \
-        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,)  \
-        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,)
-#define DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_FALLBACK(name,type,max) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,)
+#define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name, type, max)         \
+        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max,)  \
+        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name, type, max,)
+#define DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_FALLBACK(name, type, max) _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name, type, max,)
 
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max) \
-        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,static)
-#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max) \
-        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,static)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max) \
+        _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max, static)
+#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name, type, max) \
+        _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name, type, max, static)
 
-#define DUMP_STRING_TABLE(name,type,max)                                \
+#define DUMP_STRING_TABLE(name, type, max)                              \
         ({                                                              \
                 flockfile(stdout);                                      \
                 for (type _k = 0; _k < (max); _k++) {                   \
index fcbedf9e9d1d048dc9399546b73a6b26e5bd1cdf..17850c7e163fe37d954379dec610f1774f9a908d 100644 (file)
@@ -1785,7 +1785,7 @@ DEFINE_STRING_TABLE_LOOKUP_TO_STRING(timestamp_style, TimestampStyle);
 TimestampStyle timestamp_style_from_string(const char *s) {
         TimestampStyle t;
 
-        t = (TimestampStyle) string_table_lookup(timestamp_style_table, ELEMENTSOF(timestamp_style_table), s);
+        t = (TimestampStyle) string_table_lookup_from_string(timestamp_style_table, ELEMENTSOF(timestamp_style_table), s);
         if (t >= 0)
                 return t;
         if (STRPTR_IN_SET(s, "µs", "μs")) /* accept both µ symbols in unicode, i.e. micro symbol + Greek small letter mu. */
index 4c5c5b3b9aa5e625184ebb6361b2aaebbd3b864f..dbb035a94a7d91f7c11243f2391373438e81131a 100644 (file)
@@ -18,6 +18,7 @@
 #include "log.h"
 #include "macro.h"
 #include "namespace-util.h"
+#include "parse-util.h"
 #include "process-util.h"
 #include "stat-util.h"
 #include "string-table.h"
index a93132ccd81a07b86fe8ebd55a02d498d8c4ba73..74b1b13a8d86d791218baed9b2ac5f2c482b0a92 100644 (file)
@@ -3,6 +3,7 @@
 #include "kill.h"
 #include "signal-util.h"
 #include "string-table.h"
+#include "string-util.h"
 
 void kill_context_init(KillContext *c) {
         assert(c);
index 3424d978de939dd702e271e52ce1995875a30c75..174a95c6496cd3b2a1d27ddc7faae404a2873292 100644 (file)
@@ -11,6 +11,7 @@
 #include "load-dropin.h"
 #include "log.h"
 #include "manager.h"
+#include "parse-util.h"
 #include "process-util.h"
 #include "random-util.h"
 #include "scope.h"
index 7c2e49da4f6873cbd06d67c3418179053f2302dd..343030b5fbe241e6ae1284ad15f37afb3124dea5 100644 (file)
@@ -23,6 +23,7 @@
 #include "missing_magic.h"
 #include "pager.h"
 #include "parse-argument.h"
+#include "parse-util.h"
 #include "polkit-agent.h"
 #include "pretty-print.h"
 #include "process-util.h"
index d33b4974b90ea9d3476da7ba00784acdc9db0d9e..da5e304f1b1bdb0cdfceee768d6215ff1597ce0c 100644 (file)
@@ -28,6 +28,7 @@
 #include "missing_magic.h"
 #include "missing_mman.h"
 #include "mkdir.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "quota-util.h"
index 73bfc1f0fabe4e629c76d53604aee20b384c704b..f6385c6b0368641e71605257be89bbb1db01e43c 100644 (file)
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "assert-util.h"
 #include "import-compress.h"
 #include "log.h"
 #include "string-table.h"
index e244b668ee316bb839b51702f96eb2cd5776342b..3dd72ddcf4782f1e3481e597009312cf7575c8be 100644 (file)
@@ -20,6 +20,7 @@
 #include "microhttpd-util.h"
 #include "parse-argument.h"
 #include "parse-helpers.h"
+#include "parse-util.h"
 #include "pretty-print.h"
 #include "process-util.h"
 #include "rlimit-util.h"
index 400894e2a20cd096ee04a32b325befd662be1b7e..9125831a9d9267c14898655f82e3742ee52f6c9a 100644 (file)
@@ -19,6 +19,7 @@
 #include "mount-util.h"
 #include "mountpoint-util.h"
 #include "parse-argument.h"
+#include "parse-util.h"
 #include "pretty-print.h"
 #include "static-destruct.h"
 #include "string-table.h"
index 720c67c7be4c865b22eb3a50f446c7a8873fcbdc..694530818747d18712b4c18c4d604d2fa5053f7e 100644 (file)
@@ -30,6 +30,7 @@
 #include "lookup3.h"
 #include "memory-util.h"
 #include "missing_fs.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "prioq.h"
 #include "random-util.h"
index 4a91bc8b8164a7f730f98832d72e149c5aa3d9b1..03f94ce663ecd166f8ab6f8cc99f287711e22938 100644 (file)
@@ -30,6 +30,7 @@
 #include "memory-util.h"
 #include "memstream-util.h"
 #include "ordered-set.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "ratelimit.h"
index 0df52fd360bc3954f29b3d7dec5b0ff46ec23f56..638ad7dd5041c47ffdb3b9f50d4ba86dfbd78985 100644 (file)
@@ -15,6 +15,7 @@
 #include "netlink-util.h"
 #include "networkd-manager.h"
 #include "parse-helpers.h"
+#include "parse-util.h"
 #include "socket-util.h"
 #include "string-table.h"
 #include "string-util.h"
index 0bd27a45c8998c4479b04ce7a2b1089f92104187..91f9d1d88dbd9caaaf5d78dca744849af79d64df 100644 (file)
@@ -61,6 +61,7 @@
 #include "networkd-state-file.h"
 #include "networkd-sysctl.h"
 #include "networkd-wifi.h"
+#include "parse-util.h"
 #include "set.h"
 #include "socket-util.h"
 #include "stdio-util.h"
index 80fbafdb4b3c24ffcd556bc1b3f12b3b963d4102..8eaf4308f9540126f1b8082c073ca60a1c9d2afe 100644 (file)
@@ -62,6 +62,7 @@
 #include "openssl-util.h"
 #include "parse-argument.h"
 #include "parse-helpers.h"
+#include "parse-util.h"
 #include "pretty-print.h"
 #include "proc-cmdline.h"
 #include "process-util.h"
index 62a99eb7a08d9c2d4ffc10359d1119747878778f..a52d874ad85fb04f678b077c1be03c9ef97c3b41 100644 (file)
@@ -38,6 +38,7 @@
 #include "missing_syscall.h"
 #include "mkdir-label.h"
 #include "nulstr-util.h"
+#include "parse-util.h"
 #include "path-lookup.h"
 #include "plymouth-util.h"
 #include "process-util.h"
index 7bdb32192aa341e5f56944e3fe3651c8569f9da0..a9cbd62fe44abf2f90c0d6572cb8bb30395f0664 100644 (file)
@@ -15,6 +15,7 @@
 #include "fileio.h"
 #include "find-esp.h"
 #include "log.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "pe-binary.h"
 #include "pretty-print.h"
index 05a937cc5026c54435ee9def6439207073da59fa..96ce5e9006c69bf955029ce067b5edc0f993d73b 100644 (file)
@@ -12,6 +12,7 @@
 #include "fd-util.h"
 #include "memory-util.h"
 #include "missing_syscall.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "serialize.h"
 #include "string-table.h"
index c27678f011801431e0101abfa0c856ff649111a2..77573a95c01feeef6bc2617c9feadcf47c57ed78 100644 (file)
@@ -6,8 +6,10 @@
 #include "extract-word.h"
 #include "fileio.h"
 #include "log.h"
+#include "parse-util.h"
 #include "stdio-util.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "unaligned.h"
 #include "virt.h"
 
index 0dab790305f47b74a16131ef9026f15c8392b145..a91cd5bbf82f494e989b9d514d54fdb8466b3fea 100644 (file)
@@ -13,6 +13,7 @@
 #include "log.h"
 #include "macro-fundamental.h"
 #include "memory-util.h"
+#include "parse-util.h"
 #include "socket-util.h"
 #include "string-table.h"
 #include "strv.h"
index 25d919cac457a02e452adab1914c651bb4d47a09..0b8b20addde2912ae9ce60e6fd3425e61d07071f 100644 (file)
@@ -505,7 +505,7 @@ ExecCommandFlags exec_command_flags_from_string(const char *s) {
         if (streq(s, "ambient")) /* Compatibility with ambient hack, removed in v258, map to no bits set */
                 return 0;
 
-        idx = string_table_lookup(exec_command_strings, ELEMENTSOF(exec_command_strings), s);
+        idx = string_table_lookup_from_string(exec_command_strings, ELEMENTSOF(exec_command_strings), s);
         if (idx < 0)
                 return _EXEC_COMMAND_FLAGS_INVALID;
 
index 410a2d139042139dc3544f1b2c081821d3a0a985..f8273f340c98fa022ae23b1b76cb93d446b36d9b 100644 (file)
@@ -22,6 +22,7 @@
 #include "macro.h"
 #include "netlink-internal.h"
 #include "netlink-util.h"
+#include "parse-util.h"
 #include "socket-util.h"
 #include "string-table.h"
 #include "time-util.h"
index 7e42f9ae5a6a044966a6d28ba1ead48ef23960f3..b479e5f776efab59ba49daa2298578ad5dd8cf9c 100644 (file)
@@ -12,6 +12,7 @@
 #include "macro.h"
 #include "missing_syscall.h"
 #include "numa-util.h"
+#include "parse-util.h"
 #include "stdio-util.h"
 #include "string-table.h"
 
index ced3665725010b4fca5bac2b1f2f653377adbb3e..288b68ceed3a16d4773d4e8294dfd42b47ccb882 100644 (file)
@@ -3,6 +3,7 @@
 #include "format-table.h"
 #include "log.h"
 #include "parse-argument.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "signal-util.h"
 #include "stdio-util.h"
index 6bfc4868aecd5808216ac3e28796daf2adf6a7ef..627c59cac8de0ae0d022ea91da3e755be6664409 100644 (file)
@@ -539,7 +539,7 @@ int uki_hash(int fd,
                 if (!n)
                         return log_oom_debug();
 
-                i = string_table_lookup(unified_sections, _UNIFIED_SECTION_MAX, n);
+                i = string_table_lookup_from_string(unified_sections, _UNIFIED_SECTION_MAX, n);
                 if (i < 0)
                         continue;
 
index 55c597e5f9b5b5e3d3b8c99c21b5c5d608ca3cbc..fdbde7dc5e771e1caf4b1e481a3ead85e9182d85 100644 (file)
@@ -18,6 +18,7 @@
 #include "output-mode.h"
 #include "pager.h"
 #include "parse-argument.h"
+#include "parse-util.h"
 #include "path-util.h"
 #include "pretty-print.h"
 #include "process-util.h"
index fcb949fc0fc636eefc8a1f5a56384161968efac1..7dd2d981e0cf742290116a57d24c928454ad6aaf 100644 (file)
@@ -26,6 +26,7 @@
 #include "mkdir-label.h"
 #include "notify-recv.h"
 #include "os-util.h"
+#include "parse-util.h"
 #include "process-util.h"
 #include "service-util.h"
 #include "signal-util.h"