From 49c1385ba6cdbe6aaf6ccc30209055b71d3788aa Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 27 Jul 2013 09:21:15 +0200 Subject: [PATCH] bug fix, `#248 Subcircuit call cannot have a node with same name as the subcircuit' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reported by Henrik Forstén http://sourceforge.net/p/ngspice/bugs/248/ --- src/frontend/numparam/xpressn.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 77c51b81a..e4d12e742 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1927,7 +1927,7 @@ nupa_subcktcall(tdico *dico, char *s, char *x, bool err) x= a matching subckt call line, with actual params */ { - int n, i, j, k, g, h, narg = 0, ls, nest; + int n, i, j, found_j, k, g, h, narg = 0, ls, nest; SPICE_DSTRING subname; SPICE_DSTRING tstr; SPICE_DSTRING ustr; @@ -2042,18 +2042,19 @@ nupa_subcktcall(tdico *dico, char *s, char *x, bool err) scopyd(&parsebuf, &tstr); buf = spice_dstring_value(&parsebuf); - found = 0; + found = found_j = 0; token = strtok(buf, " "); /* a bit more exact - but not sufficient everytime */ j = j + (int) strlen(token) + 1; if (strcmp(token, spice_dstring_value(&subname))) while ((token = strtok(NULL, " ")) != NULL) { if (!strcmp(token, spice_dstring_value(&subname))) { found = 1; - break; + found_j = j; } j = j + (int) strlen(token) + 1; } + j = found_j; /* last occurence of subname in buf */ spice_dstring_free(&parsebuf); /* make sure that subname followed by space */