symbol.c (gfc_find_gsymbol): Simplify, don't unconditionally descend into all branches.

* symbol.c (gfc_find_gsymbol): Simplify, don't unconditionally
descend into all branches.

From-SVN: r123355
This commit is contained in:
Tobias Schlüter 2007-03-30 01:54:22 +02:00
parent 58c1146737
commit 1a54978869
2 changed files with 13 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2007-03-30 Tobias Schlüter <tobi@gcc.gnu.org>
* symbol.c (gfc_find_gsymbol): Simplify, don't unconditionally
descend into all branches.
2007-03-29 Tobias Schlüter <tobi@gcc.gnu.org>
* intrinsic.c (conv_name): Let gfc_get_string handle the format.

View File

@ -2770,20 +2770,19 @@ gfc_symbol_state(void) {
gfc_gsymbol *
gfc_find_gsymbol (gfc_gsymbol *symbol, const char *name)
{
gfc_gsymbol *s;
int c;
if (symbol == NULL)
return NULL;
if (strcmp (symbol->name, name) == 0)
return symbol;
s = gfc_find_gsymbol (symbol->left, name);
if (s != NULL)
return s;
while (symbol)
{
c = strcmp (name, symbol->name);
if (!c)
return symbol;
s = gfc_find_gsymbol (symbol->right, name);
if (s != NULL)
return s;
symbol = (c < 0) ? symbol->left : symbol->right;
}
return NULL;
}