aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-12-22 08:44:50 -0800
committerDoug Evans <xdje42@gmail.com>2014-12-22 08:44:50 -0800
commitd276311738a3863e58a1281e56e2073169e7b405 (patch)
tree2379d80d239438534bffd2941c4ecff81d6c4530
parent791244bea2544503c626ffdd5fdb4ff657f98207 (diff)
downloadgdb-d276311738a3863e58a1281e56e2073169e7b405.zip
gdb-d276311738a3863e58a1281e56e2073169e7b405.tar.gz
gdb-d276311738a3863e58a1281e56e2073169e7b405.tar.bz2
cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
gdb/ChangeLog: * cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/cp-namespace.c19
2 files changed, 13 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1c79b33..ccad5ed 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
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.
2014-12-20 Keith Seitz <keiths@redhat.com>
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index bcb2275..b3ecffb 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -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