aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2013-01-04 19:00:06 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-01-04 19:00:06 +0000
commitad8c59a1b9c665496a01871b5e21500d8945ac3f (patch)
tree78e3ea101be60bad4f19246b67a10237c11f3eaf /libiberty
parent918d445f1fe08cb05228e1b12052a55dfcd5401a (diff)
downloadgcc-ad8c59a1b9c665496a01871b5e21500d8945ac3f.zip
gcc-ad8c59a1b9c665496a01871b5e21500d8945ac3f.tar.gz
gcc-ad8c59a1b9c665496a01871b5e21500d8945ac3f.tar.bz2
re PR other/54800 (libiberty/simple-object-mach-o.c:704: possible optimisation ?)
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
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog6
-rw-r--r--libiberty/simple-object-mach-o.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 0875603..4479c77 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -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.
diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c
index af5e4f9..6fde672 100644
--- a/libiberty/simple-object-mach-o.c
+++ b/libiberty/simple-object-mach-o.c
@@ -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,