[BusyBox] [PATCH] Unnecessary dups

Felipe Kellermann stdfk at terra.com.br
Mon Sep 6 20:19:20 UTC 2004


On Mon, 6 Sep 2004 3:19pm  +0400, Vladimir N. Oleynik wrote:

> Felipe,
> 
> > Seeing the last patch Tito sent I grepped the source for unnecessary
> > bb_xstrdups (or strdups); this patch removes these.  Gives some size
> > optimization and less complexity on unnecessary duppings.
> 
> Excuse me, only a 5-minute test.

Oh fuck!  This is obvious!  How I missed that!  But that it's OK with 
ifupdown, telnet, telnetd and tftp.  New patch attached.  Thanks,

-- 
Felipe Kellermann
-------------- next part --------------
Index: networking/ifupdown.c
===================================================================
RCS file: /var/cvs/busybox/networking/ifupdown.c,v
retrieving revision 1.50
diff -u -3 -p -r1.50 ifupdown.c
--- networking/ifupdown.c	30 Jul 2004 14:45:08 -0000	1.50
+++ networking/ifupdown.c	4 Sep 2004 22:21:16 -0000
@@ -1219,7 +1219,7 @@ extern int ifupdown_main(int argc, char 
 		{
 			switch (i) {
 				case 'i':	/* interfaces */
-					interfaces = bb_xstrdup(optarg);
+					interfaces = optarg;
 					break;
 				case 'v':	/* verbose */
 					verbose = 1;
Index: networking/telnet.c
===================================================================
RCS file: /var/cvs/busybox/networking/telnet.c,v
retrieving revision 1.43
diff -u -3 -p -r1.43 telnet.c
--- networking/telnet.c	15 Mar 2004 08:28:50 -0000	1.43
+++ networking/telnet.c	4 Sep 2004 22:21:20 -0000
@@ -663,7 +663,7 @@ extern int telnet_main(int argc, char** 
 	while ((opt = getopt(argc, argv, "al:")) != EOF) {
 		switch (opt) {
 			case 'l':
-				autologin = bb_xstrdup(optarg);
+				autologin = optarg;
 				break;
 			case 'a':
 				autologin = getenv("USER");
Index: networking/telnetd.c
===================================================================
RCS file: /var/cvs/busybox/networking/telnetd.c,v
retrieving revision 1.12
diff -u -3 -p -r1.12 telnetd.c
--- networking/telnetd.c	22 Jun 2004 10:07:17 -0000	1.12
+++ networking/telnetd.c	4 Sep 2004 22:21:23 -0000
@@ -401,10 +401,10 @@ telnetd_main(int argc, char **argv)
 		if (c == EOF) break;
 		switch (c) {
 			case 'f':
-				issuefile = strdup (optarg);
+				issuefile = optarg;
 				break;
 			case 'l':
-				loginpath = strdup (optarg);
+				loginpath = optarg;
 				break;
 #ifndef CONFIG_FEATURE_TELNETD_INETD
 			case 'p':
Index: networking/tftp.c
===================================================================
RCS file: /var/cvs/busybox/networking/tftp.c,v
retrieving revision 1.28
diff -u -3 -p -r1.28 tftp.c
--- networking/tftp.c	22 Jun 2004 10:18:30 -0000	1.28
+++ networking/tftp.c	4 Sep 2004 22:21:33 -0000
@@ -538,10 +538,10 @@ int tftp_main(int argc, char **argv)
 			break;
 #endif
 		case 'l':
-			localfile = bb_xstrdup(optarg);
+			localfile = optarg;
 			break;
 		case 'r':
-			remotefile = bb_xstrdup(optarg);
+			remotefile = optarg;
 			break;
 		}
 	}


More information about the busybox mailing list