From dc8eb2b9561e17dfaf441189a6a0d42532be2e34 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 18 Nov 2017 11:59:44 +0100 Subject: [PATCH] getexpress(), ia ==> ia_ptr - (const) s --- src/frontend/numparam/xpressn.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 06faa9cc9..c22205eb9 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1340,23 +1340,24 @@ getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, const char **pi) returns tpe=='R' if (numeric, 'S' if (string only */ { + const char *ia_ptr; const char *ls_ptr; const char *iptr; iptr = *pi - s + s; - int ia, level; + int level; char c, d; nupa_type tpe; ls_ptr = s + strlen(s); - ia = (int) (iptr - s) + 1; + (ia_ptr - s) = (int) (iptr - s) + 1; - while ((ia < (ls_ptr - s)) && (s[ia - 1] <= ' ')) - ia++; /*white space ? */ + while (((ia_ptr - s) < (ls_ptr - s)) && (s[(ia_ptr - s) - 1] <= ' ')) + (ia_ptr - s)++; /*white space ? */ - if (s[ia - 1] == '"') { + if (s[(ia_ptr - s) - 1] == '"') { /* string constant */ - ia++; - iptr = ia + s; + (ia_ptr - s)++; + iptr = (ia_ptr - s) + s; while (((iptr - s) < (ls_ptr - s)) && (s[(iptr - s) - 1] != '"')) iptr++; @@ -1369,10 +1370,10 @@ getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, const char **pi) } else { - if (s[ia - 1] == '{') - ia++; + if (s[(ia_ptr - s) - 1] == '{') + (ia_ptr - s)++; - iptr = ia - 1 + s; + iptr = (ia_ptr - s) - 1 + s; do { @@ -1408,7 +1409,7 @@ getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, const char **pi) tpe = NUPA_REAL; } - pscopy(tstr_p, s, ia-1, (int) (iptr - s) - ia); + pscopy(tstr_p, s, (int)(ia_ptr - s)-1, (int) (iptr - s) - (int) (ia_ptr - s)); if (s[(iptr - s) - 1] == '}') iptr++;