summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2015-10-08 17:15:08 +0200
committerDenys Vlasenko2015-10-08 17:15:08 +0200
commit8403b01217d4dfc86e8603715eeb52f9993e09b7 (patch)
treec25cf1aac0b3d8fdf9dfa4d70328ca7f9425a98d /networking
parentd1eea8db92e963e3c482d96b10da2ec0f9c95770 (diff)
downloadbusybox-8403b01217d4dfc86e8603715eeb52f9993e09b7.zip
busybox-8403b01217d4dfc86e8603715eeb52f9993e09b7.tar.gz
iproute: more string reuse
text data bss dec hex filename 936892 932 17676 955500 e946c busybox_old 936843 932 17676 955451 e943b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/libiproute/rt_names.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/networking/libiproute/rt_names.c b/networking/libiproute/rt_names.c
index ca0bb5d..51f2e9b 100644
--- a/networking/libiproute/rt_names.c
+++ b/networking/libiproute/rt_names.c
@@ -28,8 +28,11 @@ typedef struct rtnl_tab_t {
static void rtnl_tab_initialize(const char *file, const char **tab)
{
char *token[2];
- parser_t *parser = config_open2(file, fopen_for_read);
+ char fullname[sizeof(CONFDIR"/rt_dsfield") + 8];
+ parser_t *parser;
+ sprintf(fullname, CONFDIR"/rt_%s", file);
+ parser = config_open2(fullname, fopen_for_read);
while (config_read(parser, token, 2, 2, "# \t", PARSE_NORMAL)) {
unsigned id = bb_strtou(token[0], NULL, 0);
if (id > RT_TABLE_MAX) {
@@ -94,7 +97,7 @@ static void rtnl_rtprot_initialize(void)
return;
rtnl_rtprot_tab = xzalloc(sizeof(*rtnl_rtprot_tab));
memcpy(rtnl_rtprot_tab->tab, init_tab, sizeof(init_tab));
- rtnl_tab_initialize(CONFDIR "/rt_protos", rtnl_rtprot_tab->tab);
+ rtnl_tab_initialize("protos", rtnl_rtprot_tab->tab);
}
#if 0 /* UNUSED */
@@ -131,7 +134,7 @@ static void rtnl_rtscope_initialize(void)
rtnl_rtscope_tab->tab[254] = "host";
rtnl_rtscope_tab->tab[253] = "link";
rtnl_rtscope_tab->tab[200] = "site";
- rtnl_tab_initialize(CONFDIR "/rt_scopes", rtnl_rtscope_tab->tab);
+ rtnl_tab_initialize("scopes", rtnl_rtscope_tab->tab);
}
const char* FAST_FUNC rtnl_rtscope_n2a(int id)
@@ -161,7 +164,7 @@ static void rtnl_rtrealm_initialize(void)
if (rtnl_rtrealm_tab) return;
rtnl_rtrealm_tab = xzalloc(sizeof(*rtnl_rtrealm_tab));
rtnl_rtrealm_tab->tab[0] = "unknown";
- rtnl_tab_initialize(CONFDIR "/rt_realms", rtnl_rtrealm_tab->tab);
+ rtnl_tab_initialize("realms", rtnl_rtrealm_tab->tab);
}
int FAST_FUNC rtnl_rtrealm_a2n(uint32_t *id, char *arg)
@@ -193,7 +196,7 @@ static void rtnl_rtdsfield_initialize(void)
if (rtnl_rtdsfield_tab) return;
rtnl_rtdsfield_tab = xzalloc(sizeof(*rtnl_rtdsfield_tab));
rtnl_rtdsfield_tab->tab[0] = "0";
- rtnl_tab_initialize(CONFDIR "/rt_dsfield", rtnl_rtdsfield_tab->tab);
+ rtnl_tab_initialize("dsfield", rtnl_rtdsfield_tab->tab);
}
const char* FAST_FUNC rtnl_dsfield_n2a(int id)
@@ -229,7 +232,7 @@ static void rtnl_rttable_initialize(void)
rtnl_rttable_tab->tab[255] = "local";
rtnl_rttable_tab->tab[254] = "main";
rtnl_rttable_tab->tab[253] = "default";
- rtnl_tab_initialize(CONFDIR "/rt_tables", rtnl_rttable_tab->tab);
+ rtnl_tab_initialize("tables", rtnl_rttable_tab->tab);
}
const char* FAST_FUNC rtnl_rttable_n2a(int id)