From a842144e0202d1df7387e3d6f1a96a84e43bd6f8 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 14 Dec 2014 18:12:09 +0100 Subject: [PATCH] inpcom.c, cleanup `inp_reorder_params()', swallow `end' --- src/frontend/inpcom.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 1180dac41..33607c7ec 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -115,7 +115,7 @@ static void inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struc static void inp_expand_macros_in_func(struct function_env *); static struct line *inp_expand_macros_in_deck(struct function_env *, struct line *deck); static void inp_fix_param_values(struct line *deck); -static void inp_reorder_params(struct names *subckt_w_params, struct line *deck, struct line *list_head, struct line *end); +static void inp_reorder_params(struct names *subckt_w_params, struct line *deck, struct line *list_head); static int inp_split_multi_param_lines(struct line *deck, int line_number); static void inp_sort_params(struct line *start_card, struct line *end_card, struct line *card_bf_start, struct line *s_c, struct line *e_c); static char *inp_remove_ws(char *s); @@ -501,7 +501,7 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile) unsigned int no_braces; /* number of '{' */ size_t max_line_length; /* max. line length in input deck */ - struct line *tmp_ptr1, *end; + struct line *tmp_ptr1; struct names *subckt_w_params = new_names(); struct line *working = cc->li_next; @@ -524,10 +524,7 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile) inp_expand_macros_in_deck(NULL, working); inp_fix_param_values(working); - for (end = cc; end->li_next; end = end->li_next) - ; - - inp_reorder_params(subckt_w_params, working, cc, end); + inp_reorder_params(subckt_w_params, working, cc); inp_fix_inst_calls_for_numparam(subckt_w_params, working); delete_names(subckt_w_params); @@ -3882,7 +3879,7 @@ inp_reorder_params_subckt(struct names *subckt_w_params, struct line *subckt_car static void -inp_reorder_params(struct names *subckt_w_params, struct line *deck, struct line *list_head, struct line *end) +inp_reorder_params(struct names *subckt_w_params, struct line *deck, struct line *list_head) { struct line *first_param_card = NULL; struct line *last_param_card = NULL; @@ -3890,6 +3887,11 @@ inp_reorder_params(struct names *subckt_w_params, struct line *deck, struct line struct line *prev_card = list_head; struct line *c = deck; + struct line *end; + + for (end = list_head; end->li_next; end = end->li_next) + ; + /* move .param lines to beginning of deck */ while (c != NULL) {