af-list: Remove transitive includes
This commit is contained in:
committed by
Yu Watanabe
parent
463c301fbb
commit
c034915cb6
@@ -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
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user