return 0;
}
-static void
-ansi_free (void *p)
-{
- if (p)
- free (p);
-}
-
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a
* macro for stat64(). If stat is a macro, make a local wrapper function to
* invoke it.
{
gl->gl_opendir = open_dirstream;
gl->gl_readdir = read_dirstream;
- gl->gl_closedir = ansi_free;
+ gl->gl_closedir = free;
gl->gl_stat = local_stat;
/* We don't bother setting gl_lstat, since glob never calls it.
The slot is only there for compatibility with 4.4 BSD. */
Look up the value of the variable. */
o = reference_variable (o, beg, end - beg);
- if (abeg)
free (abeg);
}
break;
r = allocated_variable_expand (tmp);
- if (alloc)
- free (alloc);
+ free (alloc);
return r;
}
if (entry_p->expand_args)
for (argvp=argv; *argvp != 0; ++argvp)
free (*argvp);
- else if (abeg)
+ else
free (abeg);
return 1;
slow_flag = strcmp ((s1 ? s1 : ""), (s2 ? s2 : ""));
- if (s1)
- free (s1);
- if (s2)
- free (s2);
+ free (s1);
+ free (s2);
}
if (slow_flag)
goto slow;
batch_mode_shell = 1;
#endif
- if (atoken)
- free (atoken);
+ free (atoken);
return (sh_found);
}
db_level = orig_db_level;
- /* Free the makefile mtimes (if we allocated any). */
- if (makefile_mtimes)
- free (makefile_mtimes);
+ /* Free the makefile mtimes. */
+ free (makefile_mtimes);
}
/* Set up 'MAKEFLAGS' again for the normal targets. */
if (cs->type == string)
{
char **val = (char **)cs->value_ptr;
- if (*val)
- free (*val);
+ free (*val);
*val = xstrdup (coptarg);
break;
}
sub-makes. Also reset job_slots since it will be put on the command
line, not in MAKEFLAGS. */
job_slots = default_job_slots;
- if (jobserver_fds)
- {
- free (jobserver_fds);
- jobserver_fds = 0;
- }
+ free (jobserver_fds);
+ jobserver_fds = 0;
}
}
\f
restore_conditionals (struct conditionals *saved)
{
/* Free any space allocated by conditional_line. */
- if (conditionals->ignoring)
- free (conditionals->ignoring);
- if (conditionals->seen_else)
- free (conditionals->seen_else);
+ free (conditionals->ignoring);
+ free (conditionals->seen_else);
/* Restore state. */
conditionals = saved;
if (flags & RM_DONTCARE)
deps->dontcare = 1;
- if (expanded)
- free (expanded);
+ free (expanded);
/* If the makefile can't be found at all, give up entirely. */
if (collapsed_length < linelen+1)
{
collapsed_length = linelen+1;
- if (collapsed)
- free (collapsed);
+ free (collapsed);
/* Don't need xrealloc: we don't need to preserve the content. */
collapsed = xmalloc (collapsed_length);
}
/* No pattern means remove all previous selective VPATH's. */
vpat = 0;
construct_vpath_list (vpat, p);
- if (vpat != 0)
- free (vpat);
+ free (vpat);
continue;
}
/* At eof, record the last rule. */
record_waiting_files ();
- if (collapsed)
- free (collapsed);
+ free (collapsed);
free (commands);
}
\f
if (gv && v != gv
&& (gv->origin == o_env_override || gv->origin == o_command))
{
- if (v->value != 0)
- free (v->value);
+ free (v->value);
v->value = xstrdup (gv->value);
v->origin = gv->origin;
v->recursive = gv->recursive;
dirs[idx++] = strcache_add_len (dir, len);
}
- if (expanded)
- free (expanded);
+ free (expanded);
}
/* Now add the standard default dirs at the end. */
globfree (&gl);
#ifndef NO_ARCHIVES
- if (arname)
- free (arname);
+ free (arname);
#endif
- if (tildep)
- free (tildep);
+ free (tildep);
}
*stringp = p;
rule = next;
}
- if (name != 0)
- free (name);
+ free (name);
}
\f
/* Create a pattern rule from a suffix rule.
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;
alloc_value[oldlen] = ' ';
memcpy (&alloc_value[oldlen + 1], val, vallen + 1);
- if (tp)
- free (tp);
+ free (tp);
}
}
}
else
v = lookup_variable (varname, strlen (varname));
- if (tp)
- free (tp);
+ free (tp);
}
}
else
v->append = append;
v->conditional = conditional;
- if (alloc_value)
- free (alloc_value);
+ free (alloc_value);
return v->special ? set_special_var (v) : v;
}
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);
startInfo.hStdError = (HANDLE)pproc->sv_stderr[1];
if (as_user) {
- if (envblk) free(envblk);
+ free(envblk);
return -1;
} else {
DB (DB_JOBS, ("CreateProcess(%s,%s,...)\n",
pproc->lerrno = E_FORK;
fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n",
exec_path ? exec_path : "NULL", command_line);
- if (envblk) free(envblk);
+ free(envblk);
free( command_line );
return(-1);
}
pproc->sv_stderr[1] = 0;
free( command_line );
- if (envblk) free(envblk);
+ free(envblk);
pproc->lerrno=0;
return 0;
}
command_line = (char*) malloc(bytes_required);
if (!command_line) {
- if (enclose_in_quotes) free(enclose_in_quotes);
+ free(enclose_in_quotes);
return NULL;
}
*/
*command_line_i = '\0';
- if (enclose_in_quotes) free(enclose_in_quotes);
+ free(enclose_in_quotes);
return command_line;
}