svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Sat Dec 16 22:19:47 UTC 2006


Author: vda
Date: 2006-12-16 14:19:47 -0800 (Sat, 16 Dec 2006)
New Revision: 16975

Log:
wget: smallish optimization


Modified:
   trunk/busybox/networking/wget.c


Changeset:
Modified: trunk/busybox/networking/wget.c
===================================================================
--- trunk/busybox/networking/wget.c	2006-12-16 22:18:44 UTC (rev 16974)
+++ trunk/busybox/networking/wget.c	2006-12-16 22:19:47 UTC (rev 16975)
@@ -363,7 +363,7 @@
 					}
 				}
 			}
-		} while(status >= 300);
+		} while (status >= 300);
 
 		dfp = sfp;
 
@@ -509,7 +509,7 @@
 
 static void parse_url(char *src_url, struct host_info *h)
 {
-	char *url, *p, *cp, *sp, *up, *pp;
+	char *url, *p, *sp;
 
 	/* h->allocated = */ url = xstrdup(src_url);
 
@@ -542,8 +542,8 @@
 	if (!sp) {
 		h->path = "";
 	} else if (*sp == '/') {
-		*sp++ = '\0';
-		h->path = sp;
+		*sp = '\0';
+		h->path = sp + 1;
 	} else { // '#' or '?'
 		// http://busybox.net?login=john@doe is a valid URL
 		// memmove converts to:
@@ -554,35 +554,35 @@
 		h->path = sp;
 	}
 
-	up = strrchr(h->host, '@');
-	if (up != NULL) {
+	sp = strrchr(h->host, '@');
+	h->user = NULL;
+	if (sp != NULL) {
 		h->user = h->host;
-		*up++ = '\0';
-		h->host = up;
-	} else
-		h->user = NULL;
+		*sp = '\0';
+		h->host = sp + 1;
+	}
 
-	pp = h->host;
+	sp = h->host;
 
 #if ENABLE_FEATURE_WGET_IP6_LITERAL
-	if (h->host[0] == '[') {
+	if (sp[0] == '[') {
 		char *ep;
 
-		ep = h->host + 1;
+		ep = sp + 1;
 		while (*ep == ':' || isxdigit(*ep))
 			ep++;
 		if (*ep == ']') {
 			h->host++;
 			*ep = '\0';
-			pp = ep + 1;
+			sp = ep + 1;
 		}
 	}
 #endif
 
-	cp = strchr(pp, ':');
-	if (cp != NULL) {
-		*cp++ = '\0';
-		h->port = htons(xatou16(cp));
+	p = strchr(sp, ':');
+	if (p != NULL) {
+		*p = '\0';
+		h->port = htons(xatou16(p + 1));
 	}
 }
 




More information about the busybox-cvs mailing list