Thread (9 messages) 9 messages, 2 authors, 2023-06-01
STALE1147d

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

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2023-06-01 17:22:04
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

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 --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",
-- 
2.39.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help