Browse Source

inpcom.c, comment_out_unused_subckt_models() #2/8, cleanup

pre-master-46
rlar 11 years ago
parent
commit
5ec24f4ed0
  1. 17
      src/frontend/inpcom.c

17
src/frontend/inpcom.c

@ -1651,8 +1651,7 @@ get_subckts_for_subckt(struct line *start_card, char *subckt_name,
if (strcmp(used_subckts->names[i], inst_subckt_name) == 0) if (strcmp(used_subckts->names[i], inst_subckt_name) == 0)
have_subckt = TRUE; have_subckt = TRUE;
if (!have_subckt) { if (!have_subckt) {
new_names[tmp_cnt++] = used_subckts->names[used_subckts->num_names] = inst_subckt_name;
used_subckts->num_names += 1;
new_names[tmp_cnt++] = used_subckts->names[used_subckts->num_names++] = inst_subckt_name;
} else { } else {
tfree(inst_subckt_name); tfree(inst_subckt_name);
} }
@ -1663,8 +1662,7 @@ get_subckts_for_subckt(struct line *start_card, char *subckt_name,
if (strcmp(used_models->names[i], model_name) == 0) if (strcmp(used_models->names[i], model_name) == 0)
found_model = TRUE; found_model = TRUE;
if (!found_model) { if (!found_model) {
used_models->names[used_models->num_names] = model_name;
used_models->num_names += 1;
used_models->names[used_models->num_names++] = model_name;
} else { } else {
tfree(model_name); tfree(model_name);
} }
@ -1677,10 +1675,10 @@ get_subckts_for_subckt(struct line *start_card, char *subckt_name,
if (is_a_modelname(model_name)) { if (is_a_modelname(model_name)) {
bool found_model = FALSE; bool found_model = FALSE;
for (i = 0; i < used_models->num_names; i++) for (i = 0; i < used_models->num_names; i++)
if (strcmp(used_models->names[i], model_name) == 0) found_model = TRUE;
if (strcmp(used_models->names[i], model_name) == 0)
found_model = TRUE;
if (!found_model) { if (!found_model) {
used_models->names[used_models->num_names] = model_name;
used_models->num_names += 1;
used_models->names[used_models->num_names++] = model_name;
} else { } else {
tfree(model_name); tfree(model_name);
} }
@ -1761,7 +1759,8 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines)
char *subckt_name = get_instance_subckt(line); char *subckt_name = get_instance_subckt(line);
bool found_subckt = FALSE; bool found_subckt = FALSE;
for (i = 0; i < used_subckts.num_names; i++) for (i = 0; i < used_subckts.num_names; i++)
if (strcmp(used_subckts.names[i], subckt_name) == 0) found_subckt = TRUE;
if (strcmp(used_subckts.names[i], subckt_name) == 0)
found_subckt = TRUE;
if (!found_subckt) { if (!found_subckt) {
used_subckts.names[used_subckts.num_names++] = subckt_name; used_subckts.names[used_subckts.num_names++] = subckt_name;
tmp_cnt++; tmp_cnt++;
@ -1861,9 +1860,9 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines)
break; break;
} }
} }
tfree(model_type);
if (!found_model) if (!found_model)
*line = '*'; *line = '*';
tfree(model_type);
tfree(model_name); tfree(model_name);
} }
} }

Loading…
Cancel
Save