From e28169d62cf0a7562ecc4d4735890dad32745f05 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 15 May 2016 18:13:51 +0200 Subject: [PATCH] transform(), reduce scope of `tstr' --- src/frontend/numparam/spicenum.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index d32af5580..8cf4b78a0 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -313,11 +313,7 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol) { int a; char *s; /* dstring value of dstr_p */ - char *t; /* dstring value of tstr */ char category; - SPICE_DSTRING tstr; /* temporary string */ - - spice_dstring_init(&tstr); stripsomespace(dstr_p, incontrol); modernizeex(dstr_p); /* required for stripbraces count */ @@ -325,19 +321,21 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol) if (s[0] == '.') { /* check PS parameter format */ - scopy_up(&tstr, spice_dstring_value(dstr_p)); - - t = spice_dstring_value(&tstr); - if (ci_prefix(".PARAM", s)) { /* comment it out */ /* s[0] = '*'; */ category = 'P'; } else if (ci_prefix(".SUBCKT", s)) { + char *t; + SPICE_DSTRING tstr; + spice_dstring_init(&tstr); + scopy_up(&tstr, s); + t = spice_dstring_value(&tstr); /* split off any "params" tail */ a = spos_("PARAMS:", t); if (a >= 0) pscopy(dstr_p, s, 0, a); + spice_dstring_free(&tstr); category = 'S'; } else if (ci_prefix(".CONTROL", s)) { category = 'C'; @@ -370,7 +368,6 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol) category = '*'; } - spice_dstring_free(&tstr); return category; }