fix bug #229 `Node name "n" is sometimes toxic'

Error: too few nodes for MOS or CPL:
m6 1 n 2 vss nch.3 l=4.3e-07 ...

http://sourceforge.net/p/ngspice/bugs/229/
This commit is contained in:
h_vogt 2013-01-18 17:28:21 +01:00 committed by rlar
parent 409207eb77
commit 6c74513120
1 changed files with 8 additions and 5 deletions

View File

@ -1472,14 +1472,16 @@ gettrans(const char *name, const char *name_end)
static bool
model_bin_match(char *token, char *model_name)
{
char *dot_char;
/* find last dot in model_name */
char *dot_char = strrchr(model_name, '.');
bool flag = FALSE;
/* continue evaluation if toeken is part of model_name */
if (strncmp(model_name, token, strlen(token)) == 0) {
/* find last dot in model_name */
if ((dot_char = strrchr(model_name, '.')) != NULL) {
/* check if token equals the substring before last dot in model_name */
if (dot_char) {
char *mtoken = copy_substring(model_name, dot_char);
if (cieq(mtoken, token)) {
flag = TRUE;
dot_char++;
/* check if model_name has binning info (trailing digit(s)) */
while (*dot_char != '\0') {
if (!isdigit(*dot_char)) {
flag = FALSE;
@ -1488,6 +1490,7 @@ model_bin_match(char *token, char *model_name)
dot_char++;
}
}
tfree(mtoken);
}
return flag;
}