From 3f5ea23c713b9cde90887cf4df3033500244dc1f Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 25 Nov 2017 17:47:40 +0100 Subject: [PATCH] nupa_subcktcall(), drop `ls_ptr' valid because neither `jp' nor `gp' will ever be incremented beyond end of string --- src/frontend/numparam/xpressn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 9ddd12c1e..7c22177a2 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1602,17 +1602,16 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name) scopy_up(&tstr, skip_non_ws(x)); char * const t_p = spice_dstring_value(&tstr); - char * const ls_ptr = t_p + spice_dstring_length(&tstr); char *p_subname = search_isolated_identifier(t_p, spice_dstring_value(&subname)); if (p_subname) { char *jp = p_subname + spice_dstring_length(&subname); /* 1st position of arglist */ - while ((jp < ls_ptr) && ((*jp <= ' ') || (*jp == ','))) + while (isspace_c(*jp) || (*jp == ',')) jp++; - while (jp < ls_ptr) { + while (*jp) { /* try to fetch valid arguments */ char *kp = jp; @@ -1630,7 +1629,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name) char *gp = kp; int nest = 1; - while ((nest > 0) && (gp < ls_ptr)) { + while ((nest > 0) && *gp) { gp++; if (*gp == '(') nest++; @@ -1638,7 +1637,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name) nest--; } - if ((gp < ls_ptr) && (nest == 0)) + if (*gp && (nest == 0)) *gp = '}'; } }