inp_search_closing_paren(), cleanup

This commit is contained in:
rlar 2013-10-03 11:53:11 +02:00
parent 1a66841e36
commit c1594627b4
1 changed files with 16 additions and 17 deletions

View File

@ -1788,44 +1788,43 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines)
// find closing paren // find closing paren
static char * static char *
inp_search_closing_paren1(char *str_ptr2) inp_search_closing_paren1(char *s)
{ {
int count = 1; int count = 1;
// assert(*str_ptr2 == '(') // assert(*s == '(')
while (count != 0 && *str_ptr2 != '\0') { while (count != 0 && *s != '\0') {
str_ptr2++; s++;
if (*str_ptr2 == '(') if (*s == '(')
count++; count++;
if (*str_ptr2 == ')') if (*s == ')')
count--; count--;
} }
if (count != 0) if (count != 0)
str_ptr2 = NULL; return NULL;
return str_ptr2; return s;
} }
static char * static char *
inp_search_for_closing_paren2(char *str_ptr2) inp_search_for_closing_paren2(char *s)
{ {
// find end paren ')'
bool found_paren = FALSE; bool found_paren = FALSE;
int count = 0; int count = 0;
// assert(*str_ptr2 == '(') // assert(*s == '(')
while (*str_ptr2 != '\0') { while (*s != '\0') {
if (*str_ptr2 == '(') { if (*s == '(') {
count++; count++;
found_paren = TRUE; found_paren = TRUE;
} }
if (*str_ptr2 == ')') if (*s == ')')
count--; count--;
str_ptr2++; s++;
if (found_paren && count == 0) if (found_paren && count == 0)
break; break;
} }
if (found_paren && count != 0) if (found_paren && count != 0)
str_ptr2 = NULL; return NULL;
return str_ptr2; return s;
} }