Hi,
I did two minor code shrinks, patch is attached:
networking/udhcp/files.c:
- use ether_aton_r instead of ether_aton, saves a memcpy.
networking/ipcalc.c:
- Replace the tolower-loop with str_tolower
Nico
$ make bloatcheck
function old new delta
ipcalc_main 614 608 -6
read_staticlease 102 85 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-23) Total: -23
bytes
text data bss dec hex filename
668219 2568 9856 680643 a62c3 busybox_old
668196 2568 9856 680620 a62ac busybox_unstripped
Index: networking/udhcp/files.c
===================================================================
--- networking/udhcp/files.c (Revision 21684)
+++ networking/udhcp/files.c (Arbeitskopie)
@@ -26,13 +26,11 @@
static int read_mac(const char *line, void *arg)
{
- uint8_t *mac_bytes = arg;
struct ether_addr *temp_ether_addr;
- temp_ether_addr = ether_aton(line);
+ temp_ether_addr = ether_aton_r(line, (struct ether_addr *)arg);
if (temp_ether_addr == NULL)
return 0;
- memcpy(mac_bytes, temp_ether_addr, 6);
return 1;
}
Index: networking/ipcalc.c
===================================================================
--- networking/ipcalc.c (Revision 21684)
+++ networking/ipcalc.c (Arbeitskopie)
@@ -175,16 +175,13 @@
if (opt & HOSTNAME) {
struct hostent *hostinfo;
- int x;
hostinfo = gethostbyaddr((char *) &ipaddr, sizeof(ipaddr), AF_INET);
if (!hostinfo) {
bb_herror_msg_and_die("cannot find hostname for %s", argv[0]);
}
- for (x = 0; hostinfo->h_name[x]; x++) {
- hostinfo->h_name[x] = tolower(hostinfo->h_name[x]);
- }
-
+ str_tolower(hostinfo->h_name);
+
printf("HOSTNAME=%s\n", hostinfo->h_name);
}
}
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox