transform(), reduce scope of `tstr'

This commit is contained in:
rlar 2016-05-15 18:13:51 +02:00
parent f776a24ea7
commit e28169d62c
1 changed files with 6 additions and 9 deletions

View File

@ -313,11 +313,7 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol)
{ {
int a; int a;
char *s; /* dstring value of dstr_p */ char *s; /* dstring value of dstr_p */
char *t; /* dstring value of tstr */
char category; char category;
SPICE_DSTRING tstr; /* temporary string */
spice_dstring_init(&tstr);
stripsomespace(dstr_p, incontrol); stripsomespace(dstr_p, incontrol);
modernizeex(dstr_p); /* required for stripbraces count */ modernizeex(dstr_p); /* required for stripbraces count */
@ -325,19 +321,21 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol)
if (s[0] == '.') { if (s[0] == '.') {
/* check PS parameter format */ /* check PS parameter format */
scopy_up(&tstr, spice_dstring_value(dstr_p));
t = spice_dstring_value(&tstr);
if (ci_prefix(".PARAM", s)) { if (ci_prefix(".PARAM", s)) {
/* comment it out */ /* comment it out */
/* s[0] = '*'; */ /* s[0] = '*'; */
category = 'P'; category = 'P';
} else if (ci_prefix(".SUBCKT", s)) { } 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 */ /* split off any "params" tail */
a = spos_("PARAMS:", t); a = spos_("PARAMS:", t);
if (a >= 0) if (a >= 0)
pscopy(dstr_p, s, 0, a); pscopy(dstr_p, s, 0, a);
spice_dstring_free(&tstr);
category = 'S'; category = 'S';
} else if (ci_prefix(".CONTROL", s)) { } else if (ci_prefix(".CONTROL", s)) {
category = 'C'; category = 'C';
@ -370,7 +368,6 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol)
category = '*'; category = '*';
} }
spice_dstring_free(&tstr);
return category; return category;
} }