af-list: Remove transitive includes

This commit is contained in:
Daan De Meyer
2025-05-07 22:04:46 +09:00
committed by Yu Watanabe
parent 463c301fbb
commit c034915cb6
3 changed files with 21 additions and 18 deletions
+15
View 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;
+4 -18
View 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);
+2
View 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"