nupa_subcktcall(), drop `ls_ptr'

valid because
neither `jp' nor `gp' will ever be incremented beyond end of string
This commit is contained in:
rlar 2017-11-25 17:47:40 +01:00
parent 437f92385a
commit 3f5ea23c71
1 changed files with 4 additions and 5 deletions

View File

@ -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 = '}';
}
}