* [PATCH] Micro-optimize cooked_index_entry::full_name
@ 2022-04-20 6:10 Tom Tromey
2022-04-20 12:16 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2022-04-20 6:10 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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.
---
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);
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Micro-optimize cooked_index_entry::full_name
2022-04-20 6:10 [PATCH] Micro-optimize cooked_index_entry::full_name Tom Tromey
@ 2022-04-20 12:16 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2022-04-20 12:16 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2022-04-20 07:10, Tom Tromey wrote:
> 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.
Looks fine to me.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-20 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 6:10 [PATCH] Micro-optimize cooked_index_entry::full_name Tom Tromey
2022-04-20 12:16 ` Pedro Alves
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).