From patchwork Wed Dec 10 17:52:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 4147 Received: (qmail 31639 invoked by alias); 10 Dec 2014 17:53:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31630 invoked by uid 89); 10 Dec 2014 17:53:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f182.google.com Received: from mail-pd0-f182.google.com (HELO mail-pd0-f182.google.com) (209.85.192.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 10 Dec 2014 17:53:41 +0000 Received: by mail-pd0-f182.google.com with SMTP id p10so3187062pdj.41 for ; Wed, 10 Dec 2014 09:53:39 -0800 (PST) X-Received: by 10.70.2.65 with SMTP id 1mr9366414pds.13.1418234019271; Wed, 10 Dec 2014 09:53:39 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id b9sm4724826pbu.95.2014.12.10.09.53.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 09:53:38 -0800 (PST) From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] Rename cp_is_anonymous to cp_is_in_anonymous Date: Wed, 10 Dec 2014 09:52:48 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes 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 * cp-support.h (cp_is_in_anonymous): Renamed from cp_is_anonymous. All callers updated. Rename arg "namesapce" to "symbol_name". 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,