inpcom.c, simplify tfree() usage

This commit is contained in:
rlar 2013-05-26 22:57:54 +02:00
parent 889c90350a
commit eda5c611e2
1 changed files with 9 additions and 17 deletions

View File

@ -211,7 +211,6 @@ read_a_lib(char *y, int call_depth, char *dir_name)
newfp = inp_pathopen(big_buff2, "r");
if (!newfp) {
fprintf(cp_err, "Error: Could not find library file %s\n", y);
if (copyy)
tfree(copyy); /* allocated by the cp_tildexpand() above */
return FALSE;
}
@ -234,7 +233,6 @@ read_a_lib(char *y, int call_depth, char *dir_name)
fclose(newfp);
}
if (copyy)
tfree(copyy); /* allocated by the cp_tildexpand() above */
return TRUE;
@ -395,7 +393,6 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
s = skip_ws(s); /* advance past space chars */
/* only the last title line remains valid */
if (new_title != NULL)
tfree(new_title);
new_title = copy(s);
if ((s = strchr(new_title, '\n')) != NULL)
@ -459,7 +456,6 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
newfp = inp_pathopen(big_buff2, "r");
if (!newfp) {
perror(y);
if (copyy)
tfree(copyy); /* allocated by the cp_tildexpand() above */
fprintf(cp_err, "Error: .include statement failed.\n");
tfree(buffer); /* allocated by readline() above */
@ -480,7 +476,6 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
(void) fclose(newfp);
}
if (copyy)
tfree(copyy); /* allocated by the cp_tildexpand() above */
/* Make the .include a comment */
@ -633,7 +628,7 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
/* Replace first line with the new title, if available */
if (new_title != NULL) {
if (cc->li_line) tfree(cc->li_line);
tfree(cc->li_line);
cc->li_line = new_title;
}
@ -1627,7 +1622,6 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines)
model_bin_match(used_model_names[i], model_name))
found_model = TRUE;
}
if (model_type)
tfree(model_type);
if (!found_model)
*line = '*';
@ -1804,9 +1798,7 @@ inp_fix_ternary_operator_str(char *line, bool all)
tfree(conditional);
tfree(if_str);
tfree(else_str);
if (beg_str != NULL)
tfree(beg_str);
if (end_str != NULL)
tfree(end_str);
return new_str;