This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
use xstrdup in named_section
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Mar 2005 13:32:59 -0800 (PST)
- Subject: use xstrdup in named_section
Unless I'm reading this completely wrong, this is xstrdup.
Bootstrapped & tested on powerpc-darwin.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-namedsectxdup.patch===================
2005-03-02 Geoffrey Keating <geoffk@apple.com>
* varasm.c (named_section): Use xstrdup rather than doing it by
hand.
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.478
diff -u -p -u -p -r1.478 varasm.c
--- varasm.c 2 Mar 2005 17:12:53 -0000 1.478
+++ varasm.c 2 Mar 2005 21:30:41 -0000
@@ -455,13 +455,8 @@ named_section (tree decl, const char *na
if (strcmp (name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) == 0
&& !unlikely_text_section_name)
- {
- unlikely_text_section_name = xmalloc
- (strlen (UNLIKELY_EXECUTED_TEXT_SECTION_NAME) + 1
- * sizeof (char));
- strcpy (unlikely_text_section_name,
- UNLIKELY_EXECUTED_TEXT_SECTION_NAME);
- }
+ unlikely_text_section_name =
+ xstrdup (UNLIKELY_EXECUTED_TEXT_SECTION_NAME);
flags = targetm.section_type_flags (decl, name, reloc);
============================================================