From 59b0f5c27b3eec8ce589d520b5a13cd3db0d8203 Mon Sep 17 00:00:00 2001 From: aaronl Date: Thu, 28 Nov 2002 11:27:31 +0000 Subject: Change if(x)free(x); to free(x); git-svn-id: svn://busybox.net/trunk/busybox@6055 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- shell/hush.c | 5 ++--- shell/lash.c | 12 ++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'shell') diff --git a/shell/hush.c b/shell/hush.c index 08b3b295f..48d1d1458 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -810,7 +810,7 @@ static void b_reset(o_string *o) 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 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str) #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; diff --git a/shell/lash.c b/shell/lash.c index 7994d2620..c4d6ef04e 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -518,12 +518,9 @@ static void free_job(struct job *cmd) 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 @@ static inline void setup_prompt_string(char **prompt_str) #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; -- cgit v1.2.3-55-g6feb