From 6c7451312079bf7cb7284e750df54f8c127270f7 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Fri, 18 Jan 2013 17:28:21 +0100 Subject: [PATCH] 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/ --- src/frontend/subckt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 2799bcf61..73934761e 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -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; }