From 01eb593ca401ca77030b53b51ffa841cdd75e7b4 Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 22 Nov 2017 22:34:22 +0100 Subject: [PATCH] findsubname(), explicit break out of the loop --- src/frontend/numparam/spicenum.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index bf60f00ea..dd089a6a9 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -169,13 +169,16 @@ findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p) int nest = 1; p--; - while ((nest > 0) && (p > s)) { + while (p > s) { if (p[-1] == '{') nest--; else if (p[-1] == '}') nest++; p--; + if (nest <= 0) { + break; + } } p_end = p; /* p_end points to '{' */