nupa_subcktcall(), reduce scope of some locals

This commit is contained in:
rlar 2016-05-15 19:54:02 +02:00
parent 9670af0d4e
commit cb4dfa13d8
1 changed files with 9 additions and 12 deletions

View File

@ -1489,16 +1489,13 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
x= a matching subckt call line, with actual params x= a matching subckt call line, with actual params
*/ */
{ {
int n, found_j, k, g, h, narg = 0, nest; int n, narg = 0;
SPICE_DSTRING subname; SPICE_DSTRING subname;
SPICE_DSTRING tstr; SPICE_DSTRING tstr;
SPICE_DSTRING ustr; SPICE_DSTRING ustr;
SPICE_DSTRING vstr; SPICE_DSTRING vstr;
SPICE_DSTRING idlist; SPICE_DSTRING idlist;
SPICE_DSTRING parsebuf; SPICE_DSTRING parsebuf;
char *buf, *token;
char *u_p;
bool found;
bool err = 0; bool err = 0;
spice_dstring_init(&subname); spice_dstring_init(&subname);
@ -1586,10 +1583,10 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
spice_dstring_init(&parsebuf); spice_dstring_init(&parsebuf);
scopyd(&parsebuf, &tstr); scopyd(&parsebuf, &tstr);
buf = spice_dstring_value(&parsebuf); char * const buf = spice_dstring_value(&parsebuf);
found = found_j = 0; int found = 0, found_j = 0;
token = strtok(buf, " "); /* a bit more exact - but not sufficient everytime */ char *token = strtok(buf, " "); /* a bit more exact - but not sufficient everytime */
j = j + (int) strlen(token) + 1; j = j + (int) strlen(token) + 1;
if (strcmp(token, spice_dstring_value(&subname))) if (strcmp(token, spice_dstring_value(&subname)))
while ((token = strtok(NULL, " ")) != NULL) { while ((token = strtok(NULL, " ")) != NULL) {
@ -1613,7 +1610,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
while (j < ls) { while (j < ls) {
/* try to fetch valid arguments */ /* try to fetch valid arguments */
k = j; int k = j;
spice_dstring_reinit(&ustr); spice_dstring_reinit(&ustr);
if (t_p[k] == Intro) { if (t_p[k] == Intro) {
@ -1625,8 +1622,8 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
/* transform to braces... */ /* transform to braces... */
k++; k++;
t_p[k] = '{'; t_p[k] = '{';
g = k; int g = k;
nest = 1; int nest = 1;
while ((nest > 0) && (g < ls)) { while ((nest > 0) && (g < ls)) {
g++; g++;
@ -1643,7 +1640,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
if (alfanum(t_p[k]) || t_p[k] == '.') { if (alfanum(t_p[k]) || t_p[k] == '.') {
/* number, identifier */ /* number, identifier */
h = k; int h = k;
while (t_p[k] > ' ') while (t_p[k] > ' ')
k++; k++;
pscopy(&ustr, spice_dstring_value(&tstr), h, k - h); pscopy(&ustr, spice_dstring_value(&tstr), h, k - h);
@ -1659,7 +1656,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
message(dico, "Subckt call, symbol %c not understood\n", t_p[k]); message(dico, "Subckt call, symbol %c not understood\n", t_p[k]);
} }
u_p = spice_dstring_value(&ustr); char * const u_p = spice_dstring_value(&ustr);
if (u_p[0]) { if (u_p[0]) {
char *dollar = strchr(spice_dstring_value(&idlist), '$'); char *dollar = strchr(spice_dstring_value(&idlist), '$');
if (dollar) { if (dollar) {