From 8aaa8765a642e82b7bcb5bb8c0260dfd5dad0837 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 2 Jun 2013 16:30:56 +0200 Subject: [PATCH] inpcom.c, local scope for `newcard' --- src/frontend/inpcom.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index e236cbe29..71fa86a27 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -317,7 +317,7 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile intfile: in, TRUE if deck is generated from internal circarray */ { - struct line *end = NULL, *cc = NULL, *prev, *working, *newcard; + struct line *end = NULL, *cc = NULL, *prev, *working; char *buffer = NULL; /* segfault fix */ #ifdef XSPICE @@ -449,6 +449,8 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile char *y = NULL; char *s, *t; + struct line *newcard; + inp_stripcomments_line(buffer); s = skip_non_ws(buffer); /* advance past non-space chars */ @@ -729,8 +731,9 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile /* get end card as last card in list; end card pntr does not appear to always be correct at this point */ - for (newcard = working; newcard; newcard = newcard->li_next) - end = newcard; + if (working) + for (end = working; end->li_next; end = end->li_next) + ; // tprint(cc); inp_reorder_params(subckt_w_params, working, cc, end); @@ -1968,7 +1971,7 @@ find_name(struct names *p, char *name) static char* inp_fix_subckt(struct names *subckt_w_params, char *s) { - struct line *head = NULL, *newcard = NULL, *start_card = NULL, *end_card = NULL, *prev_card = NULL, *c = NULL; + struct line *head = NULL, *start_card = NULL, *end_card = NULL, *prev_card = NULL, *c = NULL; char *equal, *beg, *buffer, *ptr1, *ptr2, *new_str = NULL; char keep; int num_params = 0, i = 0, bracedepth = 0; @@ -2031,14 +2034,14 @@ inp_fix_subckt(struct names *subckt_w_params, char *s) beg = ptr2 + 1; } - newcard = xx_new_line(NULL, strdup(ptr1), 0, 0); + end_card = xx_new_line(NULL, strdup(ptr1), 0, 0); if (start_card == NULL) - head->li_next = start_card = newcard; + head->li_next = start_card = end_card; else - prev_card->li_next = newcard; + prev_card->li_next = end_card; - prev_card = end_card = newcard; + prev_card = end_card; num_params++; } #else @@ -2065,14 +2068,14 @@ inp_fix_subckt(struct names *subckt_w_params, char *s) buf[buf_idx++] = '\0'; beg = p1; - newcard = xx_new_line(NULL, buf, 0, 0); + end_card = xx_new_line(NULL, buf, 0, 0); if (start_card == NULL) - head->li_next = start_card = newcard; + head->li_next = start_card = end_card; else - prev_card->li_next = newcard; + prev_card->li_next = end_card; - prev_card = end_card = newcard; + prev_card = end_card; num_params++; done = TRUE;