inp_search_closing_paren(), rewrite
This commit is contained in:
parent
f8a06900c2
commit
77478d8286
|
|
@ -1792,14 +1792,14 @@ inp_search_closing_paren1(char *s)
|
||||||
{
|
{
|
||||||
int count = 1;
|
int count = 1;
|
||||||
// assert(*s == '(')
|
// assert(*s == '(')
|
||||||
while (*s != '\0') {
|
while (*s) {
|
||||||
s++;
|
s++;
|
||||||
if (*s == '(')
|
if (*s == '(')
|
||||||
count++;
|
count++;
|
||||||
if (*s == ')')
|
if (*s == ')')
|
||||||
count--;
|
count--;
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break;
|
return s;
|
||||||
}
|
}
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1812,14 +1812,14 @@ inp_search_for_closing_paren2(char *s)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// assert(*s == '(')
|
// assert(*s == '(')
|
||||||
while (*s != '\0') {
|
while (*s) {
|
||||||
if (*s == '(')
|
if (*s == '(')
|
||||||
count++;
|
count++;
|
||||||
if (*s == ')')
|
if (*s == ')')
|
||||||
count--;
|
count--;
|
||||||
s++;
|
s++;
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break;
|
return s;
|
||||||
}
|
}
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue