* symtab.c (lookup_language_this): End loop if block is NULL.

This commit is contained in:
Tom Tromey 2011-06-20 17:53:33 +00:00
parent 185e39cdbd
commit 03de682319
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2011-06-20 Tom Tromey <tromey@redhat.com>
* symtab.c (lookup_language_this): End loop if block is NULL.
2011-06-17 Tom Tromey <tromey@redhat.com> 2011-06-17 Tom Tromey <tromey@redhat.com>
* valops.c (value_of_this): Use lookup_language_this. * valops.c (value_of_this): Use lookup_language_this.

View File

@ -1100,7 +1100,7 @@ lookup_language_this (const struct language_defn *lang,
if (lang->la_name_of_this == NULL || block == NULL) if (lang->la_name_of_this == NULL || block == NULL)
return NULL; return NULL;
while (1) while (block)
{ {
struct symbol *sym; struct symbol *sym;
@ -1108,9 +1108,11 @@ lookup_language_this (const struct language_defn *lang,
if (sym != NULL) if (sym != NULL)
return sym; return sym;
if (BLOCK_FUNCTION (block)) if (BLOCK_FUNCTION (block))
return NULL; break;
block = BLOCK_SUPERBLOCK (block); block = BLOCK_SUPERBLOCK (block);
} }
return NULL;
} }
/* Behave like lookup_symbol except that NAME is the natural name /* Behave like lookup_symbol except that NAME is the natural name