public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Two compute_and_set_names simplifications Date: Thu, 27 Feb 2020 06:11:00 -0000 [thread overview] Message-ID: <869d89506ca4b97b1b31d0d9e7508d980a3653b6@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 869d89506ca4b97b1b31d0d9e7508d980a3653b6 *** commit 869d89506ca4b97b1b31d0d9e7508d980a3653b6 Author: Tom Tromey <tom@tromey.com> AuthorDate: Wed Feb 19 17:16:51 2020 -0700 Commit: Tom Tromey <tom@tromey.com> CommitDate: Wed Feb 19 17:22:13 2020 -0700 Two compute_and_set_names simplifications This patch simplifies compute_and_set_names in a couple of ways. First, it changes one spot to use obstack_strndup, which is equivalent, but more concise. Second, the function ends with two calls to symbol_set_demangled_name. This can be simplified to a single call. gdb/ChangeLog 2020-02-19 Tom Tromey <tom@tromey.com> * symtab.c (general_symbol_info::compute_and_set_names): Use obstack_strndup. Simplify call to symbol_set_demangled_name. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b4a586c333..e3f7e9f828 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-02-19 Tom Tromey <tom@tromey.com> + + * symtab.c (general_symbol_info::compute_and_set_names): Use + obstack_strndup. Simplify call to symbol_set_demangled_name. + 2020-02-19 Simon Marchi <simon.marchi@efficios.com> * dwarf2/read.c (allocate_signatured_type_table, diff --git a/gdb/symtab.c b/gdb/symtab.c index d99be41261..a80b80db5a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -869,14 +869,9 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name, if (!copy_name) m_name = linkage_name.data (); else - { - char *name = (char *) obstack_alloc (&per_bfd->storage_obstack, - linkage_name.length () + 1); - - memcpy (name, linkage_name.data (), linkage_name.length ()); - name[linkage_name.length ()] = '\0'; - m_name = name; - } + m_name = obstack_strndup (&per_bfd->storage_obstack, + linkage_name.data (), + linkage_name.length ()); symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack); return; @@ -967,11 +962,8 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name, m_language = (*slot)->language; m_name = (*slot)->mangled.data (); - if ((*slot)->demangled != nullptr) - symbol_set_demangled_name (this, (*slot)->demangled.get (), - &per_bfd->storage_obstack); - else - symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack); + symbol_set_demangled_name (this, (*slot)->demangled.get (), + &per_bfd->storage_obstack); } /* See symtab.h. */
next reply other threads:[~2020-02-27 5:40 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-27 6:11 gdb-buildbot [this message] 2020-02-27 5:58 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot 2020-02-28 11:09 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2020-02-28 11:27 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2020-02-28 11:32 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2020-02-28 12:32 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2020-02-28 18:50 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot 2020-03-01 9:40 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
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=869d89506ca4b97b1b31d0d9e7508d980a3653b6@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@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).