[BusyBox] [PATCH] Unnecessary dups
Felipe Kellermann
stdfk at terra.com.br
Mon Sep 6 20:37:55 UTC 2004
On Mon, 6 Sep 2004 5:19pm -0300, Felipe Kellermann wrote:
> 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,
No, we are wrong. It's OK with syslogd (RemoteHost) also.
New patch attached with only `insmod' and `getty' removed.
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;
}
}
Index: sysklogd/syslogd.c
===================================================================
RCS file: /var/cvs/busybox/sysklogd/syslogd.c,v
retrieving revision 1.115
diff -u -3 -p -r1.115 syslogd.c
--- sysklogd/syslogd.c 2 Sep 2004 22:22:17 -0000 1.115
+++ sysklogd/syslogd.c 4 Sep 2004 22:21:33 -0000
@@ -642,7 +642,7 @@ extern int syslogd_main(int argc, char *
#endif
#ifdef CONFIG_FEATURE_REMOTE_LOG
case 'R':
- RemoteHost = bb_xstrdup(optarg);
+ RemoteHost = optarg;
if ((p = strchr(RemoteHost, ':'))) {
RemotePort = atoi(p + 1);
*p = '\0';
Index: util-linux/getopt.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/getopt.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 getopt.c
--- util-linux/getopt.c 14 Apr 2004 17:51:38 -0000 1.13
+++ util-linux/getopt.c 4 Sep 2004 22:21:35 -0000
@@ -340,14 +340,14 @@ int getopt_main(int argc, char *argv[])
break;
case 'o':
free(optstr);
- optstr=bb_xstrdup(optarg);
+ optstr = optarg;
break;
case 'l':
add_long_options(optarg);
break;
case 'n':
free(name);
- name=bb_xstrdup(optarg);
+ name = optarg;
break;
case 'q':
quiet_errors=1;
More information about the busybox
mailing list