use xstrdup in named_section

Geoffrey Keating gkeating@apple.com
Wed Mar 2 21:33:00 GMT 2005


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);
 
============================================================



More information about the Gcc-patches mailing list