inpcom.c, local scope for `newcard'

This commit is contained in:
rlar 2013-06-02 16:30:56 +02:00
parent 5f18566dd0
commit 8aaa8765a6
1 changed files with 15 additions and 12 deletions

View File

@ -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 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; char *buffer = NULL;
/* segfault fix */ /* segfault fix */
#ifdef XSPICE #ifdef XSPICE
@ -449,6 +449,8 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
char *y = NULL; char *y = NULL;
char *s, *t; char *s, *t;
struct line *newcard;
inp_stripcomments_line(buffer); inp_stripcomments_line(buffer);
s = skip_non_ws(buffer); /* advance past non-space chars */ 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 /* get end card as last card in list; end card pntr does not appear to always
be correct at this point */ be correct at this point */
for (newcard = working; newcard; newcard = newcard->li_next) if (working)
end = newcard; for (end = working; end->li_next; end = end->li_next)
;
// tprint(cc); // tprint(cc);
inp_reorder_params(subckt_w_params, working, cc, end); inp_reorder_params(subckt_w_params, working, cc, end);
@ -1968,7 +1971,7 @@ find_name(struct names *p, char *name)
static char* static char*
inp_fix_subckt(struct names *subckt_w_params, char *s) 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 *equal, *beg, *buffer, *ptr1, *ptr2, *new_str = NULL;
char keep; char keep;
int num_params = 0, i = 0, bracedepth = 0; 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; 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) if (start_card == NULL)
head->li_next = start_card = newcard; head->li_next = start_card = end_card;
else else
prev_card->li_next = newcard; prev_card->li_next = end_card;
prev_card = end_card = newcard; prev_card = end_card;
num_params++; num_params++;
} }
#else #else
@ -2065,14 +2068,14 @@ inp_fix_subckt(struct names *subckt_w_params, char *s)
buf[buf_idx++] = '\0'; buf[buf_idx++] = '\0';
beg = p1; beg = p1;
newcard = xx_new_line(NULL, buf, 0, 0); end_card = xx_new_line(NULL, buf, 0, 0);
if (start_card == NULL) if (start_card == NULL)
head->li_next = start_card = newcard; head->li_next = start_card = end_card;
else else
prev_card->li_next = newcard; prev_card->li_next = end_card;
prev_card = end_card = newcard; prev_card = end_card;
num_params++; num_params++;
done = TRUE; done = TRUE;