Use memcpy in minimal_symbol_reader::install
authorTom Tromey <tom@tromey.com>
Sat, 2 Mar 2019 19:31:04 +0000 (12:31 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 15 Mar 2019 22:02:10 +0000 (16:02 -0600)
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-15  Tom Tromey  <tom@tromey.com>

* minsyms.c (minimal_symbol_reader::install): Use memcpy.

gdb/ChangeLog
gdb/minsyms.c

index 581a4c6a5a92c5875753dbd9ccd6c632983bd910..8ac4515e553f79236e2069c7e7f57ff102272c66 100644 (file)
@@ -1,3 +1,7 @@
+2019-03-15  Tom Tromey  <tom@tromey.com>
+
+       * minsyms.c (minimal_symbol_reader::install): Use memcpy.
+
 2019-03-15  Tom Tromey  <tom@tromey.com>
 
        * objfiles.h (struct objfile_per_bfd_storage) <msymbols>: Now a
index 88ff2593493e56a63ff820a22791564a9138ee2f..93097b1845282d650bba5a91e4b515d1059630b9 100644 (file)
@@ -1337,7 +1337,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;
@@ -1384,8 +1383,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;
        }
 
This page took 0.036174 seconds and 4 git commands to generate.