cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.

gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
This commit is contained in:
Doug Evans 2014-12-22 08:44:50 -08:00
parent 791244bea2
commit d276311738
2 changed files with 13 additions and 10 deletions

View file

@ -1,3 +1,7 @@
2014-12-22 Doug Evans <xdje42@gmail.com>
* cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
2014-12-22 Doug Evans <xdje42@gmail.com>
* cp-namespace.c: Whitespace cleanup.

View file

@ -317,21 +317,20 @@ cp_lookup_symbol_in_namespace (const char *namespace,
const struct block *block,
const domain_enum domain, int search)
{
if (namespace[0] == '\0')
{
return lookup_symbol_file (name, block, domain, 0, search);
}
else
{
char *concatenated_name = alloca (strlen (namespace) + 2
+ strlen (name) + 1);
char *concatenated_name = NULL;
int is_anonymous = namespace[0] != '\0' && cp_is_in_anonymous (namespace);
if (namespace[0] != '\0')
{
concatenated_name = alloca (strlen (namespace) + 2
+ strlen (name) + 1);
strcpy (concatenated_name, namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, name);
return lookup_symbol_file (concatenated_name, block, domain,
cp_is_in_anonymous (namespace), search);
name = concatenated_name;
}
return lookup_symbol_file (name, block, domain, is_anonymous, search);
}
/* Used for cleanups to reset the "searched" flag incase