public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Micro-optimize cooked_index_entry::full_name Date: Wed, 20 Apr 2022 12:21:58 +0000 (GMT) [thread overview] Message-ID: <20220420122158.B3EF03858025@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=72b580b8f48927cf7bc4cf8bb951aaeff637d0ee commit 72b580b8f48927cf7bc4cf8bb951aaeff637d0ee Author: Tom Tromey <tom@tromey.com> Date: Tue Apr 19 23:44:50 2022 -0600 Micro-optimize cooked_index_entry::full_name I noticed that cooked_index_entry::full_name can return the canonical string when there is no parent entry. Regression tested on x86-64 Fedora 34. Diff: --- gdb/dwarf2/cooked-index.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index b66ef5a1c64..d8a1ab8d30e 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -50,7 +50,7 @@ eq_entry (const void *a, const void *b) const char * cooked_index_entry::full_name (struct obstack *storage) const { - if ((flags & IS_LINKAGE) != 0) + if ((flags & IS_LINKAGE) != 0 || parent_entry == nullptr) return canonical; const char *sep = nullptr; @@ -66,13 +66,12 @@ cooked_index_entry::full_name (struct obstack *storage) const case language_ada: sep = "."; break; - } - if (sep == nullptr) - return canonical; + default: + return canonical; + } - if (parent_entry != nullptr) - parent_entry->write_scope (storage, sep); + parent_entry->write_scope (storage, sep); obstack_grow0 (storage, canonical, strlen (canonical)); return (const char *) obstack_finish (storage); }
reply other threads:[~2022-04-20 12:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220420122158.B3EF03858025@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).