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 /networking/libiproute/rt_names.c | |
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>
Diffstat (limited to 'networking/libiproute/rt_names.c')
-rw-r--r-- | networking/libiproute/rt_names.c | 47 |
1 files changed, 17 insertions, 30 deletions
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) |