stripbraces(), j ==> j_ptr - (const) s
This commit is contained in:
parent
fc45b3addf
commit
686329dcaf
|
|
@ -92,7 +92,7 @@ static int
|
||||||
stripbraces(SPICE_DSTRINGPTR dstr_p)
|
stripbraces(SPICE_DSTRINGPTR dstr_p)
|
||||||
/* puts the funny placeholders. returns the number of {...} substitutions */
|
/* puts the funny placeholders. returns the number of {...} substitutions */
|
||||||
{
|
{
|
||||||
int n, i, nest, j;
|
int n, i, nest;
|
||||||
char *s0; /* value of dynamic string */
|
char *s0; /* value of dynamic string */
|
||||||
char *brace;
|
char *brace;
|
||||||
SPICE_DSTRING tstr; /* temporary dynamic string */
|
SPICE_DSTRING tstr; /* temporary dynamic string */
|
||||||
|
|
@ -109,16 +109,16 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
||||||
|
|
||||||
|
|
||||||
/* something to strip */
|
/* something to strip */
|
||||||
j = i + 1;
|
j_ptr - s = i + 1;
|
||||||
nest = 1;
|
nest = 1;
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
while ((nest > 0) && s[j]) {
|
while ((nest > 0) && s[j_ptr - s]) {
|
||||||
if (s[j] == '{')
|
if (s[j_ptr - s] == '{')
|
||||||
nest++;
|
nest++;
|
||||||
else if (s[j] == '}')
|
else if (s[j_ptr - s] == '}')
|
||||||
nest--;
|
nest--;
|
||||||
j++;
|
(j_ptr - s)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pscopy(&tstr, s, 0, i);
|
pscopy(&tstr, s, 0, i);
|
||||||
|
|
@ -134,11 +134,11 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
||||||
}
|
}
|
||||||
cadd(&tstr, ' ');
|
cadd(&tstr, ' ');
|
||||||
|
|
||||||
if (s[j] >= ' ')
|
if (s[j_ptr - s] >= ' ')
|
||||||
cadd(&tstr, ' ');
|
cadd(&tstr, ' ');
|
||||||
|
|
||||||
int ilen = spice_dstring_length(&tstr);
|
int ilen = spice_dstring_length(&tstr);
|
||||||
sadd(&tstr, s + j);
|
sadd(&tstr, s + (j_ptr - s));
|
||||||
scopyd(dstr_p, &tstr);
|
scopyd(dstr_p, &tstr);
|
||||||
s0 = spice_dstring_value(dstr_p);
|
s0 = spice_dstring_value(dstr_p);
|
||||||
i = ilen;
|
i = ilen;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue