diff options
author | Denys Vlasenko | 2015-10-08 13:02:28 +0200 |
---|---|---|
committer | Denys Vlasenko | 2015-10-08 13:02:28 +0200 |
commit | 3d8d5e8ad4d2df71e0307c385b3784586b545cbc (patch) | |
tree | 9e543be018a890ee5a2c40a2b3ed0de0f0e7dd36 /networking/libiproute/rt_names.c | |
parent | 7f3a2a22569eb8e4c9fcc1c7f4e51fe0c6155dae (diff) | |
download | busybox-3d8d5e8ad4d2df71e0307c385b3784586b545cbc.zip busybox-3d8d5e8ad4d2df71e0307c385b3784586b545cbc.tar.gz |
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 c474ab9..375f145 100644 --- a/networking/libiproute/rt_names.c +++ b/networking/libiproute/rt_names.c @@ -88,21 +88,20 @@ static void rtnl_rtprot_initialize(void) rtnl_tab_initialize("/etc/iproute2/rt_protos", rtnl_rtprot_tab->tab); } -const char* FAST_FUNC rtnl_rtprot_n2a(int id, char *buf) +#if 0 /* UNUSED */ +const char* FAST_FUNC rtnl_rtprot_n2a(int id) { if (id < 0 || id >= 256) { - sprintf(buf, "%d", id); - return buf; + return itoa(id); } rtnl_rtprot_initialize(); if (rtnl_rtprot_tab->tab[id]) return rtnl_rtprot_tab->tab[id]; - /* buf is SPRINT_BSIZE big */ - sprintf(buf, "%d", id); - return buf; + return itoa(id); } +#endif int FAST_FUNC rtnl_rtprot_a2n(uint32_t *id, char *arg) { @@ -126,20 +125,17 @@ static void rtnl_rtscope_initialize(void) rtnl_tab_initialize("/etc/iproute2/rt_scopes", rtnl_rtscope_tab->tab); } -const char* FAST_FUNC rtnl_rtscope_n2a(int id, char *buf) +const char* FAST_FUNC rtnl_rtscope_n2a(int id) { if (id < 0 || id >= 256) { - sprintf(buf, "%d", id); - return buf; + return itoa(id); } rtnl_rtscope_initialize(); if (rtnl_rtscope_tab->tab[id]) return rtnl_rtscope_tab->tab[id]; - /* buf is SPRINT_BSIZE big */ - sprintf(buf, "%d", id); - return buf; + return itoa(id); } 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) } #if ENABLE_FEATURE_IP_RULE -const char* FAST_FUNC rtnl_rtrealm_n2a(int id, char *buf) +const char* FAST_FUNC rtnl_rtrealm_n2a(int id) { if (id < 0 || id >= 256) { - sprintf(buf, "%d", id); - return buf; + return itoa(id); } rtnl_rtrealm_initialize(); if (rtnl_rtrealm_tab->tab[id]) return rtnl_rtrealm_tab->tab[id]; - /* buf is SPRINT_BSIZE big */ - sprintf(buf, "%d", id); - return buf; + return itoa(id); } #endif @@ -194,20 +187,17 @@ static void rtnl_rtdsfield_initialize(void) rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab->tab); } -const char* FAST_FUNC rtnl_dsfield_n2a(int id, char *buf) +const char* FAST_FUNC rtnl_dsfield_n2a(int id) { if (id < 0 || id >= 256) { - sprintf(buf, "%d", id); - return buf; + return itoa(id); } rtnl_rtdsfield_initialize(); if (rtnl_rtdsfield_tab->tab[id]) return rtnl_rtdsfield_tab->tab[id]; - /* buf is SPRINT_BSIZE big */ - sprintf(buf, "0x%02x", id); - return buf; + return itoa(id); } int FAST_FUNC rtnl_dsfield_a2n(uint32_t *id, char *arg) @@ -231,20 +221,17 @@ static void rtnl_rttable_initialize(void) rtnl_tab_initialize("/etc/iproute2/rt_tables", rtnl_rttable_tab->tab); } -const char* FAST_FUNC rtnl_rttable_n2a(int id, char *buf) +const char* FAST_FUNC rtnl_rttable_n2a(int id) { if (id < 0 || id >= 256) { - sprintf(buf, "%d", id); - return buf; + return itoa(id); } rtnl_rttable_initialize(); if (rtnl_rttable_tab->tab[id]) return rtnl_rttable_tab->tab[id]; - /* buf is SPRINT_BSIZE big */ - sprintf(buf, "%d", id); - return buf; + return itoa(id); } int FAST_FUNC rtnl_rttable_a2n(uint32_t *id, char *arg) |