[BusyBox-cvs] busybox/shell hush.c,1.59,1.60 lash.c,1.147,1.148

Aaron Lehmann aaronl at busybox.net
Thu Nov 28 11:27:34 UTC 2002


Update of /var/cvs/busybox/shell
In directory winder:/tmp/cvs-serv23182/shell

Modified Files:
	hush.c lash.c 
Log Message:
Change if(x)free(x); to free(x);


Index: hush.c
===================================================================
RCS file: /var/cvs/busybox/shell/hush.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- hush.c	13 Apr 2002 12:33:38 -0000	1.59
+++ hush.c	28 Nov 2002 11:27:30 -0000	1.60
@@ -810,7 +810,7 @@
 static void b_free(o_string *o)
 {
 	b_reset(o);
-	if (o->data != NULL) free(o->data);
+	free(o->data);
 	o->data = NULL;
 	o->maxlen = 0;
 }
@@ -880,8 +880,7 @@
 #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
 	/* Set up the prompt */
 	if (promptmode == 1) {
-		if (PS1)
-			free(PS1);
+		free(PS1);
 		PS1=xmalloc(strlen(cwd)+4);
 		sprintf(PS1, "%s %s", cwd, ( geteuid() != 0 ) ?  "$ ":"# ");
 		*prompt_str = PS1;

Index: lash.c
===================================================================
RCS file: /var/cvs/busybox/shell/lash.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- lash.c	8 Nov 2002 09:40:02 -0000	1.147
+++ lash.c	28 Nov 2002 11:27:30 -0000	1.148
@@ -518,12 +518,9 @@
 		if (cmd->progs[i].redirects)
 			free(cmd->progs[i].redirects);
 	}
-	if (cmd->progs)
-		free(cmd->progs);
-	if (cmd->text)
-		free(cmd->text);
-	if (cmd->cmdbuf)
-		free(cmd->cmdbuf);
+	free(cmd->progs);
+	free(cmd->text);
+	free(cmd->cmdbuf);
 	keep = cmd->job_list;
 	memset(cmd, 0, sizeof(struct job));
 	cmd->job_list = keep;
@@ -677,8 +674,7 @@
 #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
 	/* Set up the prompt */
 	if (shell_context == 0) {
-		if (PS1)
-			free(PS1);
+		free(PS1);
 		PS1=xmalloc(strlen(cwd)+4);
 		sprintf(PS1, "%s %s", cwd, ( geteuid() != 0 ) ?  "$ ":"# ");
 		*prompt_str = PS1;




More information about the busybox-cvs mailing list