unsigned short i;
if (node) {
for (i = 0; i < node->num_of_edges; i++) {
- if (node->edge[i]) {
- free(node->edge[i]);
- }
- }
- if (node->edge) {
- free(node->edge);
+ free(node->edge[i]);
}
+ free(node->edge);
free(node);
}
}
break;
}
fill_package_struct_cleanup:
- if (field_name) {
- free(field_name);
- }
- if (field_value) {
- free(field_value);
- }
+ free(field_name);
+ free(field_value);
}
if (new_node->version == search_name_hashtable("unknown")) {
fprintf(new_status_file, "%s\n\n", control_buffer);
}
- if (status_from_file != NULL) {
- free(status_from_file);
- }
+ free(status_from_file);
free(package_name);
free(control_buffer);
}
free(deb_file);
for (i = 0; i < NAME_HASH_PRIME; i++) {
- if (name_hashtable[i] != NULL) {
- free(name_hashtable[i]);
- }
+ free(name_hashtable[i]);
}
for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
}
for (i = 0; i < STATUS_HASH_PRIME; i++) {
- if (status_hashtable[i] != NULL) {
- free(status_hashtable[i]);
- }
+ free(status_hashtable[i]);
}
return(EXIT_SUCCESS);
# define ALLOC(type, array, size) { \
array = (type*)xcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
}
-# define FREE(array) {if (array != NULL) free(array), array=NULL;}
+# define FREE(array) {free(array), array=NULL;}
#else
# define DECLARE(type, array, size) static type array[size]
# define ALLOC(type, array, size)
cur = dnp[0];
while (cur != NULL) {
- if (cur->fullname != NULL)
- free(cur->fullname); /* free the filename */
+ free(cur->fullname); /* free the filename */
next = cur->next;
free(cur); /* free the dnode */
cur = next;
while (hi) {
thi = hi;
hi = hi->next;
- if (thi->data.v.string) free(thi->data.v.string);
+ free(thi->data.v.string);
free(thi);
}
array->items[i] = NULL;
/* clear a variable */
static var *clrvar(var *v) {
- if (v->string && !(v->type & VF_FSTR))
+ if (!(v->type & VF_FSTR))
free(v->string);
v->type &= VF_DONTTOUCH;
return;
is_f0_split = TRUE;
- if (fstrings) free(fstrings);
+ free(fstrings);
fsrealloc(0);
n = awk_split(getvar_s(V[F0]), &fsplitter.n, &fstrings);
fsrealloc(n);
X.rsm = (rstream *)hash_search(fdhash, L.s);
if (X.rsm) {
R.i = X.rsm->is_pipe ? pclose(X.rsm->F) : fclose(X.rsm->F);
- if (X.rsm->buffer)
- free(X.rsm->buffer);
+ free(X.rsm->buffer);
hash_remove(fdhash, L.s);
}
if (R.i != 0)
regfree(sed_cmds[ncmds].sub_match);
free(sed_cmds[ncmds].sub_match);
}
- if (sed_cmds[ncmds].replace)
- free(sed_cmds[ncmds].replace);
+ free(sed_cmds[ncmds].replace);
}
/* destroy the array */
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.24 2002/10/26 10:19:19 andersen Exp $";
+ "$Id: vi.c,v 1.25 2002/11/28 11:27:23 aaronl Exp $";
/*
* To compile for standalone use:
} else {
for (; optind < argc; optind++) {
editing = 1; // 0=exit, 1=one file, 2+ =many files
- if (cfn != 0)
- free(cfn);
+ free(cfn);
cfn = (Byte *) xstrdup(argv[optind]);
edit_file(cfn);
}
offset = 0; // no horizontal offset
c = '\0';
#ifdef CONFIG_FEATURE_VI_DOT_CMD
- if (last_modifying_cmd != 0)
- free(last_modifying_cmd);
- if (ioq_start != NULL)
- free(ioq_start);
+ free(last_modifying_cmd);
+ free(ioq_start);
ioq = ioq_start = last_modifying_cmd = 0;
adding2q = 0;
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
// There is a read-able regular file
// make this the current file
q = (Byte *) xstrdup((char *) fn); // save the cfn
- if (cfn != 0)
- free(cfn); // free the old name
+ free(cfn); // free the old name
cfn = q; // remember new cfn
vc5:
}
if (strlen((char *) args) > 0) {
// user wants a new filename
- if (cfn != NULL)
- free(cfn);
+ free(cfn);
cfn = (Byte *) xstrdup((char *) args);
} else {
// user wants file status info
{
int li;
- if (screen != 0)
- free(screen);
+ free(screen);
screensize = ro * co + 8;
screen = (Byte *) xmalloc(screensize);
// initialize the new screen. assume this will be a empty file.
{
if (size < 10240)
size = 10240; // have a minimum size for new files
- if (text != 0) {
- //text -= 4;
- free(text);
- }
+ free(text);
text = (Byte *) xmalloc(size + 8);
memset(text, '\0', size); // clear new text[]
//text += 4; // leave some room for "oops"
static void start_new_cmd_q(Byte c)
{
// release old cmd
- if (last_modifying_cmd != 0)
- free(last_modifying_cmd);
+ free(last_modifying_cmd);
// get buffer for new cmd
last_modifying_cmd = (Byte *) xmalloc(BUFSIZ);
memset(last_modifying_cmd, '\0', BUFSIZ); // clear new cmd queue
}
cnt = q - p + 1;
t = reg[dest];
- if (t != 0) { // if already a yank register
- free(t); // free it
- }
+ free(t); // if already a yank register, free it
t = (Byte *) xmalloc(cnt + 1); // get a new register
memset(t, '\0', cnt + 1); // clear new text[]
strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer
}
}
refresh(FALSE);
- if (obufp != NULL)
- free(obufp);
+ free(obufp);
obufp = (Byte *) xstrdup((char *) buf);
return (obufp);
}
goto dc3; // if no pat re-use old pat
if (strlen((char *) q) > 1) { // new pat- save it and find
// there is a new pat
- if (last_search_pattern != 0) {
- free(last_search_pattern);
- }
+ free(last_search_pattern);
last_search_pattern = (Byte *) xstrdup((char *) q);
goto dc3; // now find the pattern
}
else { /* no match */
/* Add the line to the circular 'before' buffer */
if(lines_before) {
- if(before_buf[curpos])
- free(before_buf[curpos]);
+ free(before_buf[curpos]);
before_buf[curpos] = xstrdup(line);
curpos = (curpos + 1) % lines_before;
}
while (--nregexes >= 0) {
regfree(&(regexes[nregexes]));
}
- if (regexes)
- free(regexes);
+ free(regexes);
}
#endif
members[member_num + 1] = NULL;
}
#else /* !GR_SCALE_DYNAMIC */
- if (members != NULL)
- free(members);
+ free(members);
members = (char **) malloc((member_num + 1) * sizeof(char *));
for ( ; field_begin && *field_begin != '\0'; field_begin = ptr) {
if ((ptr = strchr(field_begin, ',')) != NULL)
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
+#ident "$Id: insmod.c,v 1.92 2002/11/28 11:27:27 aaronl Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $"
+#ident "$Id: insmod.c,v 1.92 2002/11/28 11:27:27 aaronl Exp $"
/* The relocatable object is manipulated using elfin types. */
flag_export = 0;
break;
case 'o': /* name the output module */
- if(m_name) /* Hmmm, duplicate "-o name". */
- free(m_name);
+ free(m_name);
m_name = xstrdup(optarg);
break;
case 'L': /* Stub warning */
switch (c) {
case 'c':
len = strlen(optarg) > 255 ? 255 : strlen(optarg);
- if (client_config.clientid) free(client_config.clientid);
+ free(client_config.clientid);
client_config.clientid = xmalloc(len + 2);
client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
client_config.clientid[OPT_LEN] = len;
case 'h':
case 'H':
len = strlen(optarg) > 255 ? 255 : strlen(optarg);
- if (client_config.hostname) free(client_config.hostname);
+ free(client_config.hostname);
client_config.hostname = xmalloc(len + 2);
client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
client_config.hostname[OPT_LEN] = len;
{
char **dest = arg;
- if (*dest) free(*dest);
+ free(*dest);
*dest = strdup(line);
return 1;
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;
}
#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;
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;
#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;
if (name_list) {
for (i = 0; i < MAX_DEPTH; i++) {
- if (name_list[i]) {
- free(name_list[i]);
- }
+ free(name_list[i]);
}
free(name_list);
}
const char *argptr=arg;
char *bufptr;
- if (BUFFER != NULL)
- free(BUFFER);
+ free(BUFFER);
if (!quote) { /* Just copy arg */
BUFFER=xstrdup(arg);
alternative=1;
break;
case 'o':
- if (optstr)
- free(optstr);
+ free(optstr);
optstr=xstrdup(optarg);
break;
case 'l':
add_long_options(optarg);
break;
case 'n':
- if (name)
- free(name);
+ free(name);
name=xstrdup(optarg);
break;
case 'q':
this = mtab_cache;
while (this) {
next = this->next;
- if (this->device)
- free(this->device);
- if (this->mountpt)
- free(this->mountpt);
+ free(this->device);
+ free(this->mountpt);
free(this);
this = next;
}