nupa_substitute(), fix lvalues
This commit is contained in:
parent
b47123ac6a
commit
0bea4987c4
|
|
@ -1204,12 +1204,12 @@ nupa_substitute(dico_t *dico, char * const s, char *r)
|
||||||
spice_dstring_init(&qstr);
|
spice_dstring_init(&qstr);
|
||||||
spice_dstring_init(&tstr);
|
spice_dstring_init(&tstr);
|
||||||
const char *iptr;
|
const char *iptr;
|
||||||
(iptr - s) = 0;
|
iptr = s;
|
||||||
const char * const s_end = strchr(s, '\0');
|
const char * const s_end = strchr(s, '\0');
|
||||||
const char *kptr;
|
const char *kptr;
|
||||||
|
|
||||||
while (((iptr - s) < (s_end - s)) && !err) {
|
while (((iptr - s) < (s_end - s)) && !err) {
|
||||||
(iptr - s)++;
|
iptr++;
|
||||||
c = s[(iptr - s) - 1];
|
c = s[(iptr - s) - 1];
|
||||||
|
|
||||||
if (c == '{') {
|
if (c == '{') {
|
||||||
|
|
@ -1243,7 +1243,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(iptr - s) = (int) (kptr - s);
|
iptr = kptr;
|
||||||
if (!err)
|
if (!err)
|
||||||
ir = insertnumber(dico, ir, r, &qstr);
|
ir = insertnumber(dico, ir, r, &qstr);
|
||||||
else
|
else
|
||||||
|
|
@ -1253,13 +1253,13 @@ nupa_substitute(dico_t *dico, char * const s, char *r)
|
||||||
/* skip "&&" which may occur in B source */
|
/* skip "&&" which may occur in B source */
|
||||||
|
|
||||||
if (((iptr - s) + 1 < (s_end - s)) && (s[(iptr - s)] == Intro)) {
|
if (((iptr - s) + 1 < (s_end - s)) && (s[(iptr - s)] == Intro)) {
|
||||||
(iptr - s)++;
|
iptr++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(iptr - s)++;
|
iptr++;
|
||||||
while (((iptr - s) < (s_end - s)) && (s[(iptr - s) - 1] <= ' '))
|
while (((iptr - s) < (s_end - s)) && (s[(iptr - s) - 1] <= ' '))
|
||||||
(iptr - s)++;
|
iptr++;
|
||||||
|
|
||||||
kptr = s + (iptr - s);
|
kptr = s + (iptr - s);
|
||||||
|
|
||||||
|
|
@ -1290,7 +1290,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r)
|
||||||
err = evaluate_expr(dico, &qstr, xx, xx + strlen(xx));
|
err = evaluate_expr(dico, &qstr, xx, xx + strlen(xx));
|
||||||
}
|
}
|
||||||
|
|
||||||
(iptr - s) = (int) (kptr - s);
|
iptr = kptr;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* simple identifier may also be string? */
|
/* simple identifier may also be string? */
|
||||||
|
|
@ -1308,7 +1308,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r)
|
||||||
pscopy(&tstr, s, (int) (iptr - s)-1, (int) (kptr - s) - (int) (iptr - s));
|
pscopy(&tstr, s, (int) (iptr - s)-1, (int) (kptr - s) - (int) (iptr - s));
|
||||||
const char *xx = spice_dstring_value(&tstr);
|
const char *xx = spice_dstring_value(&tstr);
|
||||||
err = evaluate_variable(dico, &qstr, xx, xx + strlen(xx));
|
err = evaluate_variable(dico, &qstr, xx, xx + strlen(xx));
|
||||||
(iptr - s) = (int) (kptr - s) - 1;
|
iptr = kptr - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue