]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
af-list: Remove transitive includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 6 May 2025 11:33:49 +0000 (13:33 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 May 2025 13:04:46 +0000 (22:04 +0900)
src/basic/af-list.c
src/basic/af-list.h
src/shared/parse-helpers.c

index 91a20b2e0c0916cf1d4196a9cc8a7361d69351fb..60da592e3f8346eda2e9399f7370be075d808127 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "af-list.h"
 #include "macro.h"
+#include "string-util.h"
 
 static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
 
@@ -23,6 +24,20 @@ const char* af_to_name(int id) {
         return af_names[id];
 }
 
+const char* af_to_name_short(int id) {
+        const char *f;
+
+        if (id == AF_UNSPEC)
+                return "*";
+
+        f = af_to_name(id);
+        if (!f)
+                return "unknown";
+
+        assert(startswith(f, "AF_"));
+        return f + 3;
+}
+
 int af_from_name(const char *name) {
         const struct af_name *sc;
 
index e17762a35c0048ab51c39f85f57460449ef95e0d..07f505645837dc3a640b33f6c859363e9005666f 100644 (file)
@@ -1,26 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/socket.h>
+#include "macro.h"
 
-#include "string-util.h"
+const char* af_to_name(int id) _const_;
+int af_from_name(const char *name) _pure_;
 
-const char* af_to_name(int id);
-int af_from_name(const char *name);
-
-static inline const char* af_to_name_short(int id) {
-        const char *f;
-
-        if (id == AF_UNSPEC)
-                return "*";
-
-        f = af_to_name(id);
-        if (!f)
-                return "unknown";
-
-        assert(startswith(f, "AF_"));
-        return f + 3;
-}
+const char* af_to_name_short(int id) _const_;
 
 const char* af_to_ipv4_ipv6(int id);
 int af_from_ipv4_ipv6(const char *af);
index 63f592d18eeac9aef1372617ef0f5f9b0aff6203..348dce50590081829b5f2e11f1ebd4544344551e 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <sys/socket.h>
+
 #include "af-list.h"
 #include "extract-word.h"
 #include "ip-protocol-list.h"