summaryrefslogtreecommitdiff
path: root/networking/interface.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-19 11:12:46 +0000
committerDenis Vlasenko2007-06-19 11:12:46 +0000
commit6d9ea24611090f06b74e0e5b038b6c5b4bbe1063 (patch)
tree7fbefb532c3412b0264a9faf7d0ad3f42254b86e /networking/interface.c
parent1b16bdaebf7d0e543e048dfec9f34f06e983336c (diff)
downloadbusybox-6d9ea24611090f06b74e0e5b038b6c5b4bbe1063.zip
busybox-6d9ea24611090f06b74e0e5b038b6c5b4bbe1063.tar.gz
networking/interface.c: huke remaining big statics; use malloc for INET[6]_rresolve
return value. Went thru callers and adjusted them - code got smaller too. function old new delta ip_port_str - 126 +126 INET6_rresolve 165 182 +17 static.cache 20 24 +4 route_main 2092 2091 -1 INET_sprint 61 59 -2 INET_nn 4 - -4 INET6_sprint 59 53 -6 udp_do_one 518 508 -10 tcp_do_one 433 423 -10 raw_do_one 494 484 -10 traceroute_main 4117 4105 -12 INET_rresolve 334 321 -13 bb_displayroutes 494 456 -38 snprint_ip_port 244 - -244 static.buff 264 16 -248 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/10 up/down: 147/-598) Total: -451 bytes size busybox_old busybox_unstripped text data bss dec hex filename 751073 3048 14688 768809 bbb29 busybox_old 750873 3048 14440 768361 bb969 busybox_unstripped
Diffstat (limited to 'networking/interface.c')
-rw-r--r--networking/interface.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/networking/interface.c b/networking/interface.c
index f8721f4..204febf 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -84,13 +84,12 @@ struct in6_ifreq {
/* Display an Internet socket address. */
static const char *INET_sprint(struct sockaddr *sap, int numeric)
{
- static char buff[128];
+ static char *buff;
+ free(buff);
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
- if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap,
- numeric, 0xffffff00) != 0)
- return NULL;
+ buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
return buff;
}
@@ -167,12 +166,12 @@ static const struct aftype inet_aftype = {
/* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */
static const char *INET6_sprint(struct sockaddr *sap, int numeric)
{
- static char buff[128];
+ static char *buff;
+ free(buff);
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return "[NONE SET]";
- if (INET6_rresolve(buff, sizeof(buff), (struct sockaddr_in6 *) sap, numeric))
- return "[UNKNOWN]";
+ buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
return buff;
}