getexpress(), remove const, `pi' and rename xia_ptr --> s

This commit is contained in:
rlar 2016-05-22 12:38:46 +02:00
parent 9494f8d9af
commit f8fc4edf52
1 changed files with 13 additions and 14 deletions

View File

@ -1333,25 +1333,24 @@ getword(const char *s, SPICE_DSTRINGPTR tstr_p)
} }
static const char * static char *
getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi) getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *s)
/* returns expression-like string until next separator /* returns expression-like string until next separator
Input i=position before expr, output i=just after expr, on separator. Input i=position before expr, output i=just after expr, on separator.
returns tpe=='R' if (numeric, 'S' if (string only returns tpe=='R' if (numeric, 'S' if (string only
*/ */
{ {
const char *xia_ptr = pi; const char * const ls_ptr = s + strlen(s);
const char * const ls_ptr = xia_ptr + strlen(xia_ptr);
const char *p; const char *p;
nupa_type tpe; nupa_type tpe;
while ((xia_ptr < ls_ptr - 1) && (*xia_ptr <= ' ')) while ((s < ls_ptr - 1) && (*s <= ' '))
xia_ptr++; /*white space ? */ s++; /*white space ? */
if (*xia_ptr == '"') { if (*s == '"') {
/* string constant */ /* string constant */
xia_ptr++; s++;
p = xia_ptr; p = s;
while ((p < ls_ptr - 1) && (*p != '"')) while ((p < ls_ptr - 1) && (*p != '"'))
p++; p++;
@ -1364,10 +1363,10 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
} else { } else {
if (*xia_ptr == '{') if (*s == '{')
xia_ptr++; s++;
p = xia_ptr - 1; p = s - 1;
p++; p++;
@ -1400,7 +1399,7 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
tpe = NUPA_REAL; tpe = NUPA_REAL;
} }
pscopy(tstr_p, xia_ptr, 0, (int) (p - xia_ptr)); pscopy(tstr_p, s, 0, (int) (p - s));
if (*p == '}') if (*p == '}')
p++; p++;
@ -1411,7 +1410,7 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
if (type) if (type)
*type = tpe; *type = tpe;
return p + 1; return (char *) p + 1;
} }