From 889c90350a2ee30e2bcf1773d7e8e34927bf435c Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 29 May 2013 22:37:16 +0200 Subject: [PATCH] inpcom.c, local scope for some variables --- src/frontend/inpcom.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 284f77b6d..865ca9440 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -924,10 +924,9 @@ readline(FILE *fd) static void inp_fix_gnd_name(struct line *c) { - char *gnd; for (; c; c = c->li_next) { - gnd = c->li_line; + char *gnd = c->li_line; // if there is a comment or no gnd, go to next line if ((*gnd == '*') || (strstr(gnd, "gnd") == NULL)) continue; @@ -1191,7 +1190,6 @@ static void inp_fix_macro_param_func_paren_io(struct line *card) { char *str_ptr, *new_str; - bool is_func = FALSE; for (; card; card = card->li_next) { @@ -1233,8 +1231,8 @@ inp_fix_macro_param_func_paren_io(struct line *card) card->li_line = inp_remove_ws(card->li_line); /* remove the extra white spaces just introduced */ } } - is_func = FALSE; if (ciprefix(".param", card->li_line)) { + bool is_func = FALSE; str_ptr = skip_non_ws(card->li_line); // skip over .param str_ptr = skip_ws(str_ptr); while (!isspace(*str_ptr) && *str_ptr != '=') { @@ -1350,12 +1348,12 @@ get_subckts_for_subckt(struct line *start_card, char *subckt_name, bool has_models) { struct line *card; - char *line = NULL, *curr_subckt_name, *inst_subckt_name, *model_name, *new_names[100]; + char *curr_subckt_name, *inst_subckt_name, *model_name, *new_names[100]; bool found_subckt = FALSE, have_subckt = FALSE, found_model = FALSE; int i, num_terminals = 0, tmp_cnt = 0; for (card = start_card; card; card = card->li_next) { - line = card->li_line; + char *line = card->li_line; if (*line == '*') continue; @@ -1470,7 +1468,7 @@ static void comment_out_unused_subckt_models(struct line *start_card, int no_of_lines) { struct line *card; - char **used_subckt_names, **used_model_names, *line = NULL, *subckt_name, *model_name; + char **used_subckt_names, **used_model_names, *subckt_name, *model_name; int num_used_subckt_names = 0, num_used_model_names = 0, i = 0, num_terminals = 0, tmp_cnt = 0; bool processing_subckt = FALSE, found_subckt = FALSE, remove_subckt = FALSE, found_model = FALSE, has_models = FALSE; int skip_control = 0, nested_subckt = 0; @@ -1492,7 +1490,7 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines) } for (card = start_card; card; card = card->li_next) { - line = card->li_line; + char *line = card->li_line; if (*line == '*') continue; @@ -1583,7 +1581,7 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines) /* comment out any unused subckts, currently only at top level */ for (card = start_card; card; card = card->li_next) { - line = card->li_line; + char *line = card->li_line; if (*line == '*') continue; @@ -1818,11 +1816,10 @@ inp_fix_ternary_operator_str(char *line, bool all) static void inp_fix_ternary_operator(struct line *card) { - char *line; bool found_control = FALSE; for (; card; card = card->li_next) { - line = card->li_line; + char *line = card->li_line; /* exclude replacement of ternary function between .control and .endc */ if (ciprefix(".control", line)) @@ -2230,7 +2227,6 @@ static void inp_fix_for_numparam(struct line *c) { bool found_control = FALSE; - char *str_ptr; for (; c; c = c->li_next) { if (ciprefix(".lib", c->li_line) || ciprefix("*lib", c->li_line) || ciprefix("*inc", c->li_line)) @@ -2249,7 +2245,7 @@ inp_fix_for_numparam(struct line *c) if ((inp_compat_mode == COMPATMODE_ALL) || (inp_compat_mode == COMPATMODE_PS)) if (ciprefix(".subckt", c->li_line) || ciprefix("x", c->li_line)) { /* remove params: */ - str_ptr = strstr(c->li_line, "params:"); + char *str_ptr = strstr(c->li_line, "params:"); if (str_ptr) memcpy(str_ptr, " ", 7); }