From d4098d454bddf4d3258d328e336a227db647a935 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 12 Nov 2017 21:34:01 +0100 Subject: [PATCH] getexpress(), third argument, `char **pi' instead of `int *pi' --- src/frontend/numparam/xpressn.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index f859419ef..2b6383438 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1334,13 +1334,13 @@ getword(const char *s, SPICE_DSTRINGPTR tstr_p) static nupa_type -getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, int *pi) +getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, const char **pi) /* returns expression-like string until next separator Input i=position before expr, output i=just after expr, on separator. returns tpe=='R' if (numeric, 'S' if (string only */ { - int i = *pi; + int i = (int) (*pi - s); int ia, ls, level; char c, d; nupa_type tpe; @@ -1414,7 +1414,7 @@ getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, int *pi) if (tpe == NUPA_STRING) i++; /* beyond quote */ - *pi = i; + *pi = s + i; return tpe; } @@ -1469,7 +1469,9 @@ nupa_assignment(dico_t *dico, char *s, char mode) if (i > ls) error = message(dico, " = sign expected.\n"); - dtype = getexpress(s, &ustr, &i); + const char *tmp = s + i; + dtype = getexpress(s, &ustr, &tmp); + i = (int) (tmp - s); if (dtype == NUPA_REAL) { const char *tmp = spice_dstring_value(&ustr); @@ -1675,7 +1677,10 @@ nupa_subcktcall(dico_t *dico, char *s, char *x, char *inst_name) pscopy(&ustr, spice_dstring_value(&tstr), h, k - h); j = k; } else if (t_p[k] == '{') { - getexpress(spice_dstring_value(&tstr), &ustr, &j); + char *aux = spice_dstring_value(&tstr); + const char *tmp = aux + j; + getexpress(aux, &ustr, &tmp); + j = (int) (tmp - aux); j--; /* confusion: j was in Turbo Pascal convention */ } else { j++;