]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR other/54800 (libiberty/simple-object-mach-o.c:704: possible optimisation ?)
authorIan Lance Taylor <iant@google.com>
Fri, 4 Jan 2013 19:00:06 +0000 (19:00 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 4 Jan 2013 19:00:06 +0000 (19:00 +0000)
PR other/54800
* simple-object-mach-o.c (simple_object_mach_o_segment): Don't
bother to zero out a buffer we are about to set anyhow.

From-SVN: r194914

libiberty/ChangeLog
libiberty/simple-object-mach-o.c

index 0875603bc75113b3e013075a43992300dc6d6178..4479c77f27489915673a4845f7719d51d796fd24 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-04  Ian Lance Taylor  <iant@google.com>
+
+       PR other/54800
+       * simple-object-mach-o.c (simple_object_mach_o_segment): Don't
+       bother to zero out a buffer we are about to set anyhow.
+
 2013-01-01  David Edelsohn  <dje.gcc@gmail.com>
 
        * simple-object-xcoff.c: New file.
index af5e4f9ca8841d825b56d6bc044d268f30ab9cfd..6fde6722bef415b87f273986ffa4b4922b5a2456 100644 (file)
@@ -1,5 +1,5 @@
 /* simple-object-mach-o.c -- routines to manipulate Mach-O object files.
-   Copyright 2010, 2011 Free Software Foundation, Inc.
+   Copyright 2010, 2011, 2013 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Google.
 
 This program is free software; you can redistribute it and/or modify it
@@ -701,12 +701,13 @@ simple_object_mach_o_segment (simple_object_read *sobj, off_t offset,
           /* Otherwise, make a name like __segment,__section as per the
              convention in mach-o asm.  */
          name = &namebuf[0];
-         memset (namebuf, 0, MACH_O_NAME_LEN * 2 + 2);
          memcpy (namebuf, (char *) sechdr + segname_offset, MACH_O_NAME_LEN);
+         namebuf[MACH_O_NAME_LEN] = '\0';
          l = strlen (namebuf);
          namebuf[l] = ',';
          memcpy (namebuf + l + 1, (char *) sechdr + sectname_offset,
                  MACH_O_NAME_LEN);
+         namebuf[l + 1 + MACH_O_NAME_LEN] = '\0';
        }
 
       simple_object_mach_o_section_info (omr->is_big_endian, is_32, sechdr,