diff mbox series

[iproute2,4/7] rt_names: drop unused rtnl_addrprot_a2n

Message ID 20230601172145.51357-5-stephen@networkplumber.org (mailing list archive)
State Superseded
Delegated to: Stephen Hemminger
Headers show
Series localize functions where possible | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger June 1, 2023, 5:21 p.m. UTC
This function is defined but never used in current code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 include/rt_names.h |  1 -
 lib/rt_names.c     | 33 ---------------------------------
 2 files changed, 34 deletions(-)
diff mbox series

Patch

diff --git a/include/rt_names.h b/include/rt_names.h
index e96d80f30554..9003e67785b3 100644
--- a/include/rt_names.h
+++ b/include/rt_names.h
@@ -14,7 +14,6 @@  const char *rtnl_dsfield_get_name(int id);
 const char *rtnl_group_n2a(int id, char *buf, int len);
 
 int rtnl_rtprot_a2n(__u32 *id, const char *arg);
-int rtnl_addrprot_a2n(__u32 *id, const char *arg);
 int rtnl_rtscope_a2n(__u32 *id, const char *arg);
 int rtnl_rttable_a2n(__u32 *id, const char *arg);
 int rtnl_rtrealm_a2n(__u32 *id, const char *arg);
diff --git a/lib/rt_names.c b/lib/rt_names.c
index 51d11fd056b1..8af3bca3245b 100644
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -255,39 +255,6 @@  numeric:
 	return buf;
 }
 
-int rtnl_addrprot_a2n(__u32 *id, const char *arg)
-{
-	static char *cache;
-	static unsigned long res;
-	char *end;
-	int i;
-
-	if (cache && strcmp(cache, arg) == 0) {
-		*id = res;
-		return 0;
-	}
-
-	if (!rtnl_addrprot_tab_initialized)
-		rtnl_addrprot_initialize();
-
-	for (i = 0; i < 256; i++) {
-		if (rtnl_addrprot_tab[i] &&
-		    strcmp(rtnl_addrprot_tab[i], arg) == 0) {
-			cache = rtnl_addrprot_tab[i];
-			res = i;
-			*id = res;
-			return 0;
-		}
-	}
-
-	res = strtoul(arg, &end, 0);
-	if (!end || end == arg || *end || res > 255)
-		return -1;
-	*id = res;
-	return 0;
-}
-
-
 static char *rtnl_rtscope_tab[256] = {
 	[RT_SCOPE_UNIVERSE]	= "global",
 	[RT_SCOPE_NOWHERE]	= "nowhere",