From 06501162e50e13164f6c0971a1b5e95aa9aef50c Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 15 May 2016 20:31:07 +0200 Subject: [PATCH] nupa_substitute(), make use of the transformations --- src/frontend/numparam/xpressn.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index d059ee056..d79da0b8a 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1199,10 +1199,8 @@ nupa_substitute(dico_t *dico, const char *s, char *r) bool err = 0; SPICE_DSTRING qstr; /* temp result dynamic string */ - SPICE_DSTRING tstr; /* temp dynamic string */ spice_dstring_init(&qstr); - spice_dstring_init(&tstr); const char * const s_end = strchr(s, '\0'); const char *kptr; @@ -1229,15 +1227,13 @@ nupa_substitute(dico_t *dico, const char *s, char *r) if (d == '\0') { err = message(dico, "Closing \"}\" not found.\n"); } else { - pscopy(&tstr, s, 0, (int) (kptr - s - 1)); /* exeption made for .meas */ if (s + 4 == kptr - 1 && strncasecmp(s, "LAST", 4) == 0) { spice_dstring_reinit(&qstr); sadd(&qstr, "last"); err = 0; } else { - const char *xx = spice_dstring_value(&tstr); - err = evaluate_expr(dico, &qstr, xx, xx + strlen(xx)); + err = evaluate_expr(dico, &qstr, s, kptr - 1); } } @@ -1284,9 +1280,7 @@ nupa_substitute(dico_t *dico, const char *s, char *r) if (kptr > s_end) { err = message(dico, "Closing \")\" not found.\n"); } else { - pscopy(&tstr, s, 0, (int) (kptr - s - 1)); - const char *xx = spice_dstring_value(&tstr); - err = evaluate_expr(dico, &qstr, xx, xx + strlen(xx)); + err = evaluate_expr(dico, &qstr, s, kptr - 1); } s = kptr; @@ -1305,9 +1299,7 @@ nupa_substitute(dico_t *dico, const char *s, char *r) } while ((kptr <= s_end) && (d > ' ')); - pscopy(&tstr, s - 1, 0, (int) (kptr - s)); - const char *xx = spice_dstring_value(&tstr); - err = evaluate_variable(dico, &qstr, xx, xx + strlen(xx)); + err = evaluate_variable(dico, &qstr, s - 1, kptr - 1); s = kptr - 1; } @@ -1319,7 +1311,6 @@ nupa_substitute(dico_t *dico, const char *s, char *r) } spice_dstring_free(&qstr); - spice_dstring_free(&tstr); return err; }