svn commit: trunk/busybox/networking: udhcp

vda at busybox.net vda at busybox.net
Thu Apr 10 02:09:40 UTC 2008


Author: vda
Date: 2008-04-09 19:09:40 -0700 (Wed, 09 Apr 2008)
New Revision: 21688

Log:
udhcp,ipcalc: simple code shrink (Nico Erfurth <masta AT perlgolf.de>)

function                                             old     new   delta
ipcalc_main                                          609     610      +1
read_staticlease                                     102      85     -17
ether_aton                                            17       -     -17



Modified:
   trunk/busybox/networking/ipcalc.c
   trunk/busybox/networking/udhcp/files.c


Changeset:
Modified: trunk/busybox/networking/ipcalc.c
===================================================================
--- trunk/busybox/networking/ipcalc.c	2008-04-10 02:03:21 UTC (rev 21687)
+++ trunk/busybox/networking/ipcalc.c	2008-04-10 02:09:40 UTC (rev 21688)
@@ -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);
 		}
 	}

Modified: trunk/busybox/networking/udhcp/files.c
===================================================================
--- trunk/busybox/networking/udhcp/files.c	2008-04-10 02:03:21 UTC (rev 21687)
+++ trunk/busybox/networking/udhcp/files.c	2008-04-10 02:09:40 UTC (rev 21688)
@@ -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;
 }
 




More information about the busybox-cvs mailing list