stripbraces(), use `strchr()'
This commit is contained in:
parent
26ff93abd9
commit
98ec9c2fa3
|
|
@ -95,6 +95,7 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
|||
int n, i, nest, ls, j;
|
||||
char *s; /* value of dynamic string */
|
||||
char *t_p; /* value of t dynamic string */
|
||||
char *brace;
|
||||
SPICE_DSTRING tstr; /* temporary dynamic string */
|
||||
|
||||
n = 0;
|
||||
|
|
@ -103,9 +104,10 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
|||
ls = spice_dstring_length(dstr_p);
|
||||
i = 0;
|
||||
|
||||
while (i < ls) {
|
||||
while ((brace = strchr(s + i, '{')) != NULL) {
|
||||
|
||||
i = (int) (brace - s);
|
||||
|
||||
if (s[i] == '{') {
|
||||
|
||||
/* something to strip */
|
||||
j = i + 1;
|
||||
|
|
@ -143,12 +145,6 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
|||
scopyd(dstr_p, &tstr);
|
||||
s = spice_dstring_value(dstr_p);
|
||||
ls = spice_dstring_length(dstr_p);
|
||||
|
||||
} else {
|
||||
|
||||
i++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dynsubst = placeholder;
|
||||
|
|
|
|||
Loading…
Reference in New Issue