diff mbox

Rename cp_is_anonymous to cp_is_in_anonymous

Message ID m3fvcn4cjz.fsf@sspiff.org
State New
Headers show

Commit Message

Doug Evans Dec. 10, 2014, 5:52 p.m. UTC
Hi.

cp-namespace.c has a lot of readability issues.
In the produces of doing bigger cleanups and speedups,
I'd like to make cp-namespace.c more readable.

This is a small step in that direction.
[I have more to come, but where they are independent of each other
I'm keeping them separate.]
When I read "cp_is_anonymous" I think
strcmp (name, CP_ANONYMOUS_NAMESPACE_STR),
not strstr (name, CP_ANONYMOUS_NAMESPACE_STR).

One could also make cp_is_in_anonymous static, but it's a nice
general API-like routine, so I'm leaving it public.
[And at any rate making it static could be a separate patch.]

2014-12-10  Doug Evans  <xdje42@gmail.com>

	* cp-support.h (cp_is_in_anonymous): Renamed from cp_is_anonymous.
	All callers updated.  Rename arg "namesapce" to "symbol_name".

Comments

Doug Evans Dec. 13, 2014, 6:36 p.m. UTC | #1
On Wed, Dec 10, 2014 at 9:52 AM, Doug Evans <xdje42@gmail.com> wrote:
> Hi.
>
> cp-namespace.c has a lot of readability issues.
> In the produces of doing bigger cleanups and speedups,
> I'd like to make cp-namespace.c more readable.
>
> This is a small step in that direction.
> [I have more to come, but where they are independent of each other
> I'm keeping them separate.]
> When I read "cp_is_anonymous" I think
> strcmp (name, CP_ANONYMOUS_NAMESPACE_STR),
> not strstr (name, CP_ANONYMOUS_NAMESPACE_STR).
>
> One could also make cp_is_in_anonymous static, but it's a nice
> general API-like routine, so I'm leaving it public.
> [And at any rate making it static could be a separate patch.]
>
> 2014-12-10  Doug Evans  <xdje42@gmail.com>
>
>         * cp-support.h (cp_is_in_anonymous): Renamed from cp_is_anonymous.
>         All callers updated.  Rename arg "namesapce" to "symbol_name".

Committed.
diff mbox

Patch

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index fcfd17b..2d6748f 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -64,7 +64,7 @@  cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
       /* Start with a quick-and-dirty check for mention of "(anonymous
 	 namespace)".  */
 
-      if (!cp_is_anonymous (name))
+      if (!cp_is_in_anonymous (name))
 	return;
 
       previous_component = 0;
@@ -208,9 +208,9 @@  cp_add_using_directive (const char *dest,
    namespace; return nonzero if so.  */
 
 int
-cp_is_anonymous (const char *namespace)
+cp_is_in_anonymous (const char *symbol_name)
 {
-  return (strstr (namespace, CP_ANONYMOUS_NAMESPACE_STR)
+  return (strstr (symbol_name, CP_ANONYMOUS_NAMESPACE_STR)
 	  != NULL);
 }
 
@@ -260,7 +260,7 @@  cp_lookup_symbol_in_namespace (const char *namespace,
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
       return lookup_symbol_file (concatenated_name, block, domain,
-				 cp_is_anonymous (namespace), search);
+				 cp_is_in_anonymous (namespace), search);
     }
 }
 
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index c0ae35b..08a9905 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -179,7 +179,7 @@  extern struct type *cp_lookup_rtti_type (const char *name,
 
 /* Functions/variables from cp-namespace.c.  */
 
-extern int cp_is_anonymous (const char *namespace);
+extern int cp_is_in_anonymous (const char *symbol_name);
 
 extern void cp_add_using_directive (const char *dest,
                                     const char *src,