diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-08 13:02:28 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-08 13:02:28 +0200 |
commit | 3d8d5e8ad4d2df71e0307c385b3784586b545cbc (patch) | |
tree | 9e543be018a890ee5a2c40a2b3ed0de0f0e7dd36 | |
parent | 7f3a2a22569eb8e4c9fcc1c7f4e51fe0c6155dae (diff) | |
download | busybox-w32-3d8d5e8ad4d2df71e0307c385b3784586b545cbc.tar.gz busybox-w32-3d8d5e8ad4d2df71e0307c385b3784586b545cbc.tar.bz2 busybox-w32-3d8d5e8ad4d2df71e0307c385b3784586b545cbc.zip |
libiproute: use itoa() where appropriate
function old new delta
rtnl_rtprot_a2n 31 88 +57
print_tunnel 647 640 -7
print_route 1865 1858 -7
print_linkinfo 820 812 -8
print_addrinfo 1241 1227 -14
rtnl_rttable_n2a 53 38 -15
rtnl_rtscope_n2a 53 38 -15
rtnl_rtrealm_n2a 53 38 -15
rtnl_dsfield_n2a 61 38 -23
rtnl_rtntype_n2a 118 89 -29
print_rule 724 689 -35
ipaddr_list_or_flush 1293 1253 -40
rtnl_rtprot_n2a 53 - -53
rtnl_rtprot_initialize 63 - -63
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/11 up/down: 57/-324) Total: -267 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/libiproute/ipaddress.c | 14 | ||||
-rw-r--r-- | networking/libiproute/iproute.c | 3 | ||||
-rw-r--r-- | networking/libiproute/iprule.c | 11 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 3 | ||||
-rw-r--r-- | networking/libiproute/ll_map.c | 1 | ||||
-rw-r--r-- | networking/libiproute/rt_names.c | 47 | ||||
-rw-r--r-- | networking/libiproute/rt_names.h | 11 | ||||
-rw-r--r-- | networking/libiproute/rtm_map.c | 6 | ||||
-rw-r--r-- | networking/libiproute/rtm_map.h | 2 |
9 files changed, 37 insertions, 61 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index a6d5129e7..8845cab91 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -137,12 +137,11 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n) | |||
137 | { | 137 | { |
138 | unsigned m_flag = 0; | 138 | unsigned m_flag = 0; |
139 | if (tb[IFLA_LINK]) { | 139 | if (tb[IFLA_LINK]) { |
140 | SPRINT_BUF(b1); | ||
141 | int iflink = *(int*)RTA_DATA(tb[IFLA_LINK]); | 140 | int iflink = *(int*)RTA_DATA(tb[IFLA_LINK]); |
142 | if (iflink == 0) | 141 | if (iflink == 0) |
143 | printf("@NONE: "); | 142 | printf("@NONE: "); |
144 | else { | 143 | else { |
145 | printf("@%s: ", ll_idx_n2a(iflink, b1)); | 144 | printf("@%s: ", ll_index_to_name(iflink)); |
146 | m_flag = ll_index_to_flags(iflink); | 145 | m_flag = ll_index_to_flags(iflink); |
147 | m_flag = !(m_flag & IFF_UP); | 146 | m_flag = !(m_flag & IFF_UP); |
148 | } | 147 | } |
@@ -158,8 +157,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n) | |||
158 | printf("qdisc %s ", (char*)RTA_DATA(tb[IFLA_QDISC])); | 157 | printf("qdisc %s ", (char*)RTA_DATA(tb[IFLA_QDISC])); |
159 | #ifdef IFLA_MASTER | 158 | #ifdef IFLA_MASTER |
160 | if (tb[IFLA_MASTER]) { | 159 | if (tb[IFLA_MASTER]) { |
161 | SPRINT_BUF(b1); | 160 | printf("master %s ", ll_index_to_name(*(int*)RTA_DATA(tb[IFLA_MASTER]))); |
162 | printf("master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1)); | ||
163 | } | 161 | } |
164 | #endif | 162 | #endif |
165 | /* IFLA_OPERSTATE was added to kernel with the same commit as IFF_DORMANT */ | 163 | /* IFLA_OPERSTATE was added to kernel with the same commit as IFF_DORMANT */ |
@@ -218,7 +216,6 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, | |||
218 | int len = n->nlmsg_len; | 216 | int len = n->nlmsg_len; |
219 | struct rtattr * rta_tb[IFA_MAX+1]; | 217 | struct rtattr * rta_tb[IFA_MAX+1]; |
220 | char abuf[256]; | 218 | char abuf[256]; |
221 | SPRINT_BUF(b1); | ||
222 | 219 | ||
223 | if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR) | 220 | if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR) |
224 | return 0; | 221 | return 0; |
@@ -250,7 +247,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, | |||
250 | if (rta_tb[IFA_LABEL]) | 247 | if (rta_tb[IFA_LABEL]) |
251 | label = RTA_DATA(rta_tb[IFA_LABEL]); | 248 | label = RTA_DATA(rta_tb[IFA_LABEL]); |
252 | else | 249 | else |
253 | label = ll_idx_n2a(ifa->ifa_index, b1); | 250 | label = ll_index_to_name(ifa->ifa_index); |
254 | if (fnmatch(G_filter.label, label, 0) != 0) | 251 | if (fnmatch(G_filter.label, label, 0) != 0) |
255 | return 0; | 252 | return 0; |
256 | } | 253 | } |
@@ -325,7 +322,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, | |||
325 | abuf, sizeof(abuf)) | 322 | abuf, sizeof(abuf)) |
326 | ); | 323 | ); |
327 | } | 324 | } |
328 | printf("scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1)); | 325 | printf("scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope)); |
329 | if (ifa->ifa_flags & IFA_F_SECONDARY) { | 326 | if (ifa->ifa_flags & IFA_F_SECONDARY) { |
330 | ifa->ifa_flags &= ~IFA_F_SECONDARY; | 327 | ifa->ifa_flags &= ~IFA_F_SECONDARY; |
331 | printf("secondary "); | 328 | printf("secondary "); |
@@ -556,12 +553,11 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush) | |||
556 | continue; | 553 | continue; |
557 | } | 554 | } |
558 | if (G_filter.label) { | 555 | if (G_filter.label) { |
559 | SPRINT_BUF(b1); | ||
560 | const char *label; | 556 | const char *label; |
561 | if (tb[IFA_LABEL]) | 557 | if (tb[IFA_LABEL]) |
562 | label = RTA_DATA(tb[IFA_LABEL]); | 558 | label = RTA_DATA(tb[IFA_LABEL]); |
563 | else | 559 | else |
564 | label = ll_idx_n2a(ifa->ifa_index, b1); | 560 | label = ll_index_to_name(ifa->ifa_index); |
565 | if (fnmatch(G_filter.label, label, 0) != 0) | 561 | if (fnmatch(G_filter.label, label, 0) != 0) |
566 | continue; | 562 | continue; |
567 | } | 563 | } |
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 170c67b30..6ecd5f719 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -87,7 +87,6 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
87 | inet_prefix dst; | 87 | inet_prefix dst; |
88 | inet_prefix src; | 88 | inet_prefix src; |
89 | int host_len = -1; | 89 | int host_len = -1; |
90 | SPRINT_BUF(b1); | ||
91 | 90 | ||
92 | if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { | 91 | if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { |
93 | fprintf(stderr, "Not a route: %08x %08x %08x\n", | 92 | fprintf(stderr, "Not a route: %08x %08x %08x\n", |
@@ -236,7 +235,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
236 | printf("Deleted "); | 235 | printf("Deleted "); |
237 | } | 236 | } |
238 | if (r->rtm_type != RTN_UNICAST /* && !G_filter.type - always 0 */) { | 237 | if (r->rtm_type != RTN_UNICAST /* && !G_filter.type - always 0 */) { |
239 | printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1)); | 238 | printf("%s ", rtnl_rtntype_n2a(r->rtm_type)); |
240 | } | 239 | } |
241 | 240 | ||
242 | if (tb[RTA_DST]) { | 241 | if (tb[RTA_DST]) { |
diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index 8dbe6bd92..774a3e220 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c | |||
@@ -45,7 +45,6 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
45 | int host_len = -1; | 45 | int host_len = -1; |
46 | struct rtattr * tb[RTA_MAX+1]; | 46 | struct rtattr * tb[RTA_MAX+1]; |
47 | char abuf[256]; | 47 | char abuf[256]; |
48 | SPRINT_BUF(b1); | ||
49 | 48 | ||
50 | if (n->nlmsg_type != RTM_NEWRULE) | 49 | if (n->nlmsg_type != RTM_NEWRULE) |
51 | return 0; | 50 | return 0; |
@@ -110,7 +109,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
110 | } | 109 | } |
111 | 110 | ||
112 | if (r->rtm_tos) { | 111 | if (r->rtm_tos) { |
113 | printf("tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1)); | 112 | printf("tos %s ", rtnl_dsfield_n2a(r->rtm_tos)); |
114 | } | 113 | } |
115 | if (tb[RTA_PROTOINFO]) { | 114 | if (tb[RTA_PROTOINFO]) { |
116 | printf("fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO])); | 115 | printf("fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO])); |
@@ -121,7 +120,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
121 | } | 120 | } |
122 | 121 | ||
123 | if (r->rtm_table) | 122 | if (r->rtm_table) |
124 | printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1)); | 123 | printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table)); |
125 | 124 | ||
126 | if (tb[RTA_FLOW]) { | 125 | if (tb[RTA_FLOW]) { |
127 | uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]); | 126 | uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]); |
@@ -129,10 +128,10 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
129 | to &= 0xFFFF; | 128 | to &= 0xFFFF; |
130 | if (from) { | 129 | if (from) { |
131 | printf("realms %s/", | 130 | printf("realms %s/", |
132 | rtnl_rtrealm_n2a(from, b1)); | 131 | rtnl_rtrealm_n2a(from)); |
133 | } | 132 | } |
134 | printf("%s ", | 133 | printf("%s ", |
135 | rtnl_rtrealm_n2a(to, b1)); | 134 | rtnl_rtrealm_n2a(to)); |
136 | } | 135 | } |
137 | 136 | ||
138 | if (r->rtm_type == RTN_NAT) { | 137 | if (r->rtm_type == RTN_NAT) { |
@@ -145,7 +144,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
145 | } else | 144 | } else |
146 | printf("masquerade"); | 145 | printf("masquerade"); |
147 | } else if (r->rtm_type != RTN_UNICAST) | 146 | } else if (r->rtm_type != RTN_UNICAST) |
148 | fputs(rtnl_rtntype_n2a(r->rtm_type, b1), stdout); | 147 | fputs(rtnl_rtntype_n2a(r->rtm_type), stdout); |
149 | 148 | ||
150 | bb_putchar('\n'); | 149 | bb_putchar('\n'); |
151 | /*fflush_all();*/ | 150 | /*fflush_all();*/ |
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index b54c3c53f..a65d5e579 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
@@ -432,13 +432,12 @@ static void print_tunnel(struct ip_tunnel_parm *p) | |||
432 | else | 432 | else |
433 | printf(" ttl inherit "); | 433 | printf(" ttl inherit "); |
434 | if (p->iph.tos) { | 434 | if (p->iph.tos) { |
435 | SPRINT_BUF(b1); | ||
436 | printf(" tos"); | 435 | printf(" tos"); |
437 | if (p->iph.tos & 1) | 436 | if (p->iph.tos & 1) |
438 | printf(" inherit"); | 437 | printf(" inherit"); |
439 | if (p->iph.tos & ~1) | 438 | if (p->iph.tos & ~1) |
440 | printf("%c%s ", p->iph.tos & 1 ? '/' : ' ', | 439 | printf("%c%s ", p->iph.tos & 1 ? '/' : ' ', |
441 | rtnl_dsfield_n2a(p->iph.tos & ~1, b1)); | 440 | rtnl_dsfield_n2a(p->iph.tos & ~1)); |
442 | } | 441 | } |
443 | if (!(p->iph.frag_off & htons(IP_DF))) | 442 | if (!(p->iph.frag_off & htons(IP_DF))) |
444 | printf(" nopmtudisc"); | 443 | printf(" nopmtudisc"); |
diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c index 27cd90f34..feb6e8d22 100644 --- a/networking/libiproute/ll_map.c +++ b/networking/libiproute/ll_map.c | |||
@@ -99,7 +99,6 @@ const char FAST_FUNC *ll_idx_n2a(int idx, char *buf) | |||
99 | return buf; | 99 | return buf; |
100 | } | 100 | } |
101 | 101 | ||
102 | |||
103 | const char FAST_FUNC *ll_index_to_name(int idx) | 102 | const char FAST_FUNC *ll_index_to_name(int idx) |
104 | { | 103 | { |
105 | static char nbuf[16]; | 104 | static char nbuf[16]; |
diff --git a/networking/libiproute/rt_names.c b/networking/libiproute/rt_names.c index c474ab903..375f14528 100644 --- a/networking/libiproute/rt_names.c +++ b/networking/libiproute/rt_names.c | |||
@@ -88,21 +88,20 @@ static void rtnl_rtprot_initialize(void) | |||
88 | rtnl_tab_initialize("/etc/iproute2/rt_protos", rtnl_rtprot_tab->tab); | 88 | rtnl_tab_initialize("/etc/iproute2/rt_protos", rtnl_rtprot_tab->tab); |
89 | } | 89 | } |
90 | 90 | ||
91 | const char* FAST_FUNC rtnl_rtprot_n2a(int id, char *buf) | 91 | #if 0 /* UNUSED */ |
92 | const char* FAST_FUNC rtnl_rtprot_n2a(int id) | ||
92 | { | 93 | { |
93 | if (id < 0 || id >= 256) { | 94 | if (id < 0 || id >= 256) { |
94 | sprintf(buf, "%d", id); | 95 | return itoa(id); |
95 | return buf; | ||
96 | } | 96 | } |
97 | 97 | ||
98 | rtnl_rtprot_initialize(); | 98 | rtnl_rtprot_initialize(); |
99 | 99 | ||
100 | if (rtnl_rtprot_tab->tab[id]) | 100 | if (rtnl_rtprot_tab->tab[id]) |
101 | return rtnl_rtprot_tab->tab[id]; | 101 | return rtnl_rtprot_tab->tab[id]; |
102 | /* buf is SPRINT_BSIZE big */ | 102 | return itoa(id); |
103 | sprintf(buf, "%d", id); | ||
104 | return buf; | ||
105 | } | 103 | } |
104 | #endif | ||
106 | 105 | ||
107 | int FAST_FUNC rtnl_rtprot_a2n(uint32_t *id, char *arg) | 106 | int FAST_FUNC rtnl_rtprot_a2n(uint32_t *id, char *arg) |
108 | { | 107 | { |
@@ -126,20 +125,17 @@ static void rtnl_rtscope_initialize(void) | |||
126 | rtnl_tab_initialize("/etc/iproute2/rt_scopes", rtnl_rtscope_tab->tab); | 125 | rtnl_tab_initialize("/etc/iproute2/rt_scopes", rtnl_rtscope_tab->tab); |
127 | } | 126 | } |
128 | 127 | ||
129 | const char* FAST_FUNC rtnl_rtscope_n2a(int id, char *buf) | 128 | const char* FAST_FUNC rtnl_rtscope_n2a(int id) |
130 | { | 129 | { |
131 | if (id < 0 || id >= 256) { | 130 | if (id < 0 || id >= 256) { |
132 | sprintf(buf, "%d", id); | 131 | return itoa(id); |
133 | return buf; | ||
134 | } | 132 | } |
135 | 133 | ||
136 | rtnl_rtscope_initialize(); | 134 | rtnl_rtscope_initialize(); |
137 | 135 | ||
138 | if (rtnl_rtscope_tab->tab[id]) | 136 | if (rtnl_rtscope_tab->tab[id]) |
139 | return rtnl_rtscope_tab->tab[id]; | 137 | return rtnl_rtscope_tab->tab[id]; |
140 | /* buf is SPRINT_BSIZE big */ | 138 | return itoa(id); |
141 | sprintf(buf, "%d", id); | ||
142 | return buf; | ||
143 | } | 139 | } |
144 | 140 | ||
145 | int FAST_FUNC rtnl_rtscope_a2n(uint32_t *id, char *arg) | 141 | int FAST_FUNC rtnl_rtscope_a2n(uint32_t *id, char *arg) |
@@ -166,20 +162,17 @@ int FAST_FUNC rtnl_rtrealm_a2n(uint32_t *id, char *arg) | |||
166 | } | 162 | } |
167 | 163 | ||
168 | #if ENABLE_FEATURE_IP_RULE | 164 | #if ENABLE_FEATURE_IP_RULE |
169 | const char* FAST_FUNC rtnl_rtrealm_n2a(int id, char *buf) | 165 | const char* FAST_FUNC rtnl_rtrealm_n2a(int id) |
170 | { | 166 | { |
171 | if (id < 0 || id >= 256) { | 167 | if (id < 0 || id >= 256) { |
172 | sprintf(buf, "%d", id); | 168 | return itoa(id); |
173 | return buf; | ||
174 | } | 169 | } |
175 | 170 | ||
176 | rtnl_rtrealm_initialize(); | 171 | rtnl_rtrealm_initialize(); |
177 | 172 | ||
178 | if (rtnl_rtrealm_tab->tab[id]) | 173 | if (rtnl_rtrealm_tab->tab[id]) |
179 | return rtnl_rtrealm_tab->tab[id]; | 174 | return rtnl_rtrealm_tab->tab[id]; |
180 | /* buf is SPRINT_BSIZE big */ | 175 | return itoa(id); |
181 | sprintf(buf, "%d", id); | ||
182 | return buf; | ||
183 | } | 176 | } |
184 | #endif | 177 | #endif |
185 | 178 | ||
@@ -194,20 +187,17 @@ static void rtnl_rtdsfield_initialize(void) | |||
194 | rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab->tab); | 187 | rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab->tab); |
195 | } | 188 | } |
196 | 189 | ||
197 | const char* FAST_FUNC rtnl_dsfield_n2a(int id, char *buf) | 190 | const char* FAST_FUNC rtnl_dsfield_n2a(int id) |
198 | { | 191 | { |
199 | if (id < 0 || id >= 256) { | 192 | if (id < 0 || id >= 256) { |
200 | sprintf(buf, "%d", id); | 193 | return itoa(id); |
201 | return buf; | ||
202 | } | 194 | } |
203 | 195 | ||
204 | rtnl_rtdsfield_initialize(); | 196 | rtnl_rtdsfield_initialize(); |
205 | 197 | ||
206 | if (rtnl_rtdsfield_tab->tab[id]) | 198 | if (rtnl_rtdsfield_tab->tab[id]) |
207 | return rtnl_rtdsfield_tab->tab[id]; | 199 | return rtnl_rtdsfield_tab->tab[id]; |
208 | /* buf is SPRINT_BSIZE big */ | 200 | return itoa(id); |
209 | sprintf(buf, "0x%02x", id); | ||
210 | return buf; | ||
211 | } | 201 | } |
212 | 202 | ||
213 | int FAST_FUNC rtnl_dsfield_a2n(uint32_t *id, char *arg) | 203 | int FAST_FUNC rtnl_dsfield_a2n(uint32_t *id, char *arg) |
@@ -231,20 +221,17 @@ static void rtnl_rttable_initialize(void) | |||
231 | rtnl_tab_initialize("/etc/iproute2/rt_tables", rtnl_rttable_tab->tab); | 221 | rtnl_tab_initialize("/etc/iproute2/rt_tables", rtnl_rttable_tab->tab); |
232 | } | 222 | } |
233 | 223 | ||
234 | const char* FAST_FUNC rtnl_rttable_n2a(int id, char *buf) | 224 | const char* FAST_FUNC rtnl_rttable_n2a(int id) |
235 | { | 225 | { |
236 | if (id < 0 || id >= 256) { | 226 | if (id < 0 || id >= 256) { |
237 | sprintf(buf, "%d", id); | 227 | return itoa(id); |
238 | return buf; | ||
239 | } | 228 | } |
240 | 229 | ||
241 | rtnl_rttable_initialize(); | 230 | rtnl_rttable_initialize(); |
242 | 231 | ||
243 | if (rtnl_rttable_tab->tab[id]) | 232 | if (rtnl_rttable_tab->tab[id]) |
244 | return rtnl_rttable_tab->tab[id]; | 233 | return rtnl_rttable_tab->tab[id]; |
245 | /* buf is SPRINT_BSIZE big */ | 234 | return itoa(id); |
246 | sprintf(buf, "%d", id); | ||
247 | return buf; | ||
248 | } | 235 | } |
249 | 236 | ||
250 | int FAST_FUNC rtnl_rttable_a2n(uint32_t *id, char *arg) | 237 | int FAST_FUNC rtnl_rttable_a2n(uint32_t *id, char *arg) |
diff --git a/networking/libiproute/rt_names.h b/networking/libiproute/rt_names.h index e73aa851c..29932d6a4 100644 --- a/networking/libiproute/rt_names.h +++ b/networking/libiproute/rt_names.h | |||
@@ -4,12 +4,11 @@ | |||
4 | 4 | ||
5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | 5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
6 | 6 | ||
7 | /* buf is SPRINT_BSIZE big */ | 7 | extern const char* rtnl_rtprot_n2a(int id) FAST_FUNC; |
8 | extern const char* rtnl_rtprot_n2a(int id, char *buf) FAST_FUNC; | 8 | extern const char* rtnl_rtscope_n2a(int id) FAST_FUNC; |
9 | extern const char* rtnl_rtscope_n2a(int id, char *buf) FAST_FUNC; | 9 | extern const char* rtnl_rtrealm_n2a(int id) FAST_FUNC; |
10 | extern const char* rtnl_rtrealm_n2a(int id, char *buf) FAST_FUNC; | 10 | extern const char* rtnl_dsfield_n2a(int id) FAST_FUNC; |
11 | extern const char* rtnl_dsfield_n2a(int id, char *buf) FAST_FUNC; | 11 | extern const char* rtnl_rttable_n2a(int id) FAST_FUNC; |
12 | extern const char* rtnl_rttable_n2a(int id, char *buf) FAST_FUNC; | ||
13 | extern int rtnl_rtprot_a2n(uint32_t *id, char *arg) FAST_FUNC; | 12 | extern int rtnl_rtprot_a2n(uint32_t *id, char *arg) FAST_FUNC; |
14 | extern int rtnl_rtscope_a2n(uint32_t *id, char *arg) FAST_FUNC; | 13 | extern int rtnl_rtscope_a2n(uint32_t *id, char *arg) FAST_FUNC; |
15 | extern int rtnl_rtrealm_a2n(uint32_t *id, char *arg) FAST_FUNC; | 14 | extern int rtnl_rtrealm_a2n(uint32_t *id, char *arg) FAST_FUNC; |
diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c index 3bab53baf..c763da049 100644 --- a/networking/libiproute/rtm_map.c +++ b/networking/libiproute/rtm_map.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include "rt_names.h" | 12 | #include "rt_names.h" |
13 | #include "utils.h" | 13 | #include "utils.h" |
14 | 14 | ||
15 | const char* FAST_FUNC rtnl_rtntype_n2a(int id, char *buf) | 15 | const char* FAST_FUNC rtnl_rtntype_n2a(int id) |
16 | { | 16 | { |
17 | switch (id) { | 17 | switch (id) { |
18 | case RTN_UNSPEC: | 18 | case RTN_UNSPEC: |
@@ -40,9 +40,7 @@ const char* FAST_FUNC rtnl_rtntype_n2a(int id, char *buf) | |||
40 | case RTN_XRESOLVE: | 40 | case RTN_XRESOLVE: |
41 | return "xresolve"; | 41 | return "xresolve"; |
42 | default: | 42 | default: |
43 | /* buf is SPRINT_BSIZE big */ | 43 | return itoa(id); |
44 | sprintf(buf, "%d", id); | ||
45 | return buf; | ||
46 | } | 44 | } |
47 | } | 45 | } |
48 | 46 | ||
diff --git a/networking/libiproute/rtm_map.h b/networking/libiproute/rtm_map.h index 4377bd590..63b665169 100644 --- a/networking/libiproute/rtm_map.h +++ b/networking/libiproute/rtm_map.h | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | 5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
6 | 6 | ||
7 | const char *rtnl_rtntype_n2a(int id, char *buf) FAST_FUNC; | 7 | const char *rtnl_rtntype_n2a(int id) FAST_FUNC; |
8 | int rtnl_rtntype_a2n(int *id, char *arg) FAST_FUNC; | 8 | int rtnl_rtntype_a2n(int *id, char *arg) FAST_FUNC; |
9 | 9 | ||
10 | int get_rt_realms(uint32_t *realms, char *arg) FAST_FUNC; | 10 | int get_rt_realms(uint32_t *realms, char *arg) FAST_FUNC; |