Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 8/9] Use memcpy in minimal_symbol_reader::install
Date: Thu, 07 Mar 2019 20:57:00 -0000	[thread overview]
Message-ID: <20190307205709.21919-9-tom@tromey.com> (raw)
In-Reply-To: <20190307205709.21919-1-tom@tromey.com>

minimal_symbol_reader::install copies minsyms from the msym_bunch
objects into the allocated memory.  It seemed better to me to do this
via memcpy, as that is frequently optimized in libc.

gdb/ChangeLog
2019-03-07  Tom Tromey  <tom@tromey.com>

	* minsyms.c (minimal_symbol_reader::install): Use memcpy.
---
 gdb/ChangeLog | 4 ++++
 gdb/minsyms.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index f86105db7ee..4f3c929cd72 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1330,7 +1330,6 @@ build_minimal_symbol_hash_tables (struct objfile *objfile)
 void
 minimal_symbol_reader::install ()
 {
-  int bindex;
   int mcount;
   struct msym_bunch *bunch;
   struct minimal_symbol *msymbols;
@@ -1377,8 +1376,9 @@ minimal_symbol_reader::install ()
 
       for (bunch = m_msym_bunch; bunch != NULL; bunch = bunch->next)
 	{
-	  for (bindex = 0; bindex < m_msym_bunch_index; bindex++, mcount++)
-	    msymbols[mcount] = bunch->contents[bindex];
+	  memcpy (&msymbols[mcount], &bunch->contents[0],
+		  m_msym_bunch_index * sizeof (struct minimal_symbol));
+	  mcount += m_msym_bunch_index;
 	  m_msym_bunch_index = BUNCH_SIZE;
 	}
 
-- 
2.17.2


  reply	other threads:[~2019-03-07 20:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 21:11 [PATCH 0/9] Minor minimal symbol improvements Tom Tromey
2019-03-07 20:57 ` Tom Tromey [this message]
2019-03-07 20:57 ` [PATCH 6/9] Use htab_up for demangled hash Tom Tromey
2019-03-07 20:57 ` [PATCH 3/9] Remove some unneeded initializations in minimal_symbol_reader Tom Tromey
2019-03-07 20:57 ` [PATCH 2/9] Introduce and use language_set Tom Tromey
2019-03-07 23:05   ` John Baldwin
2019-03-08 22:21     ` Tom Tromey
2019-03-08 22:43     ` Tom Tromey
2019-03-08 23:44       ` John Baldwin
2019-03-07 20:57 ` [PATCH 4/9] Remove minsym termination Tom Tromey
2019-03-07 20:57 ` [PATCH 9/9] Change minimal_symbol inheritance Tom Tromey
2019-03-07 20:57 ` [PATCH 1/9] Slightly simplify minsym creation Tom Tromey
2019-03-07 20:57 ` [PATCH 7/9] Allocate minimal symbols with malloc Tom Tromey
2019-03-07 20:57 ` [PATCH 5/9] Simplify per-BFD storage management Tom Tromey
2019-03-15 22:04 ` [PATCH 0/9] Minor minimal symbol improvements Tom Tromey

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=20190307205709.21919-9-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@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: link
Be 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