From d73a265c45af4aa21bc7ab370d5733ab3c52528e Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 18 Nov 2017 17:20:45 +0100 Subject: [PATCH] defsubckt(), j ==> j_ptr - (const) s --- src/frontend/numparam/xpressn.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index ac3d69615..3e55aa67e 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -511,10 +511,9 @@ defsubckt(dico_t *dico, struct card *card, nupa_type categ) int w = card->linenum; bool err; - int j; const char * const ls_ptr = s + strlen(s); - const char *i_ptr; + const char *i_ptr, *j_ptr; i_ptr = s; while (((i_ptr - s) < (ls_ptr - s)) && (s[(i_ptr - s)] != '.')) @@ -526,15 +525,15 @@ defsubckt(dico_t *dico, struct card *card, nupa_type categ) while (((i_ptr - s) < (ls_ptr - s)) && (s[(i_ptr - s)] <= ' ')) i_ptr++; /* skip blank */ - j = (int) (i_ptr - s); + (j_ptr - s) = (int) (i_ptr - s); - while ((j < (ls_ptr - s)) && (s[j] > ' ')) - j++; + while (((j_ptr - s) < (ls_ptr - s)) && (s[(j_ptr - s)] > ' ')) + (j_ptr - s)++; - if (j > (i_ptr - s)) { + if ((j_ptr - s) > (i_ptr - s)) { SPICE_DSTRING ustr; /* temp user string */ spice_dstring_init(&ustr); - pscopy_up(&ustr, s, (int) (i_ptr - s), j - (int) (i_ptr - s)); + pscopy_up(&ustr, s, (int) (i_ptr - s), (int) (j_ptr - s) - (int) (i_ptr - s)); err = nupa_define(dico, spice_dstring_value(&ustr), ' ', categ, 0.0, w, NULL); spice_dstring_free(&ustr); } else {