From ed36a1cdbee053be8c11902b349a0aedb6991b28 Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Wed, 28 May 2025 11:28:21 +0100 Subject: [PATCH] Fix Bug #792 - "N device instance line not parsed correct". Code added by 83d3890490 failed with a single parameter with no speces. --- src/spicelib/parser/inp2n.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/spicelib/parser/inp2n.c b/src/spicelib/parser/inp2n.c index 526455024..ef6c9a742 100644 --- a/src/spicelib/parser/inp2n.c +++ b/src/spicelib/parser/inp2n.c @@ -34,7 +34,7 @@ void INP2N(CKTcircuit *ckt, INPtables *tab, struct card *current) { GENmodel *mdfast; /* Pointer to the actual model. */ IFdevice *dev; CKTnode *node; - char *c, *token = NULL, *prev = NULL, *pprev = NULL; + char *c, *token = NULL, *prev = NULL, *pprev = NULL, *eqp; int i; line = current->line; @@ -44,15 +44,16 @@ void INP2N(CKTcircuit *ckt, INPtables *tab, struct card *current) { /* Find the last non-parameter token in the line. */ c = line; - for (i = 0; *c != '\0'; ++i) { + for (i = 0, eqp = NULL; *c != '\0'; ++i) { tfree(pprev); pprev = prev; prev = token; token = gettok_instance(&c); - if (strchr(token, '=')) + eqp = strchr(token, '='); + if (eqp) break; } - if (*c) { + if (eqp) { tfree(token); // A parameter or starts with '='. if (*c == '=') { /* Now prev points to a parameter pprev is the model. */