summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2014-04-25 17:38:08 -0400
committerPaul Smith <psmith@gnu.org>2014-07-07 01:59:03 -0400
commit423c3955d97dc84986be08ed0074d8eb58c624ef (patch)
tree1a8e0f15f0dc8d22ed7c2472c87fc71ea1434e0c /variable.c
parentac67346d0fb5e5ea359d34c2c9215bd1892455f3 (diff)
downloadgunmake-423c3955d97dc84986be08ed0074d8eb58c624ef.tar.gz
* various: Assume ISO C89-compliant free() implementation.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/variable.c b/variable.c
index 4df8d8d..3f57e7d 100644
--- a/variable.c
+++ b/variable.c
@@ -222,8 +222,7 @@ define_variable_in_set (const char *name, unsigned int length,
than this one, don't redefine it. */
if ((int) origin >= (int) v->origin)
{
- if (v->value != 0)
- free (v->value);
+ free (v->value);
v->value = xstrdup (value);
if (flocp != 0)
v->fileinfo = *flocp;
@@ -1233,8 +1232,7 @@ do_variable_definition (const gmk_floc *flocp, const char *varname,
alloc_value[oldlen] = ' ';
memcpy (&alloc_value[oldlen + 1], val, vallen + 1);
- if (tp)
- free (tp);
+ free (tp);
}
}
}
@@ -1359,8 +1357,7 @@ do_variable_definition (const gmk_floc *flocp, const char *varname,
else
v = lookup_variable (varname, strlen (varname));
- if (tp)
- free (tp);
+ free (tp);
}
}
else
@@ -1380,8 +1377,7 @@ do_variable_definition (const gmk_floc *flocp, const char *varname,
v->append = append;
v->conditional = conditional;
- if (alloc_value)
- free (alloc_value);
+ free (alloc_value);
return v->special ? set_special_var (v) : v;
}
@@ -1764,16 +1760,10 @@ sync_Path_environment (void)
if (!path)
return;
- /*
- * If done this before, don't leak memory unnecessarily.
- * Free the previous entry before allocating new one.
- */
- if (environ_path)
- free (environ_path);
+ /* If done this before, free the previous entry before allocating new one. */
+ free (environ_path);
- /*
- * Create something WINDOWS32 world can grok
- */
+ /* Create something WINDOWS32 world can grok. */
convert_Path_to_windows32 (path, ';');
environ_path = xstrdup (concat (3, "PATH", "=", path));
putenv (environ_path);