]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libiberty: dupargv: rewrite to use xstrdup
authorMike Frysinger <vapier@gentoo.org>
Tue, 5 Jan 2016 19:55:21 +0000 (19:55 +0000)
committerMike Frysinger <vapier@gcc.gnu.org>
Tue, 5 Jan 2016 19:55:21 +0000 (19:55 +0000)
This func is basically open coding the xstrdup function, so gut it
and use that directly.

From-SVN: r232086

libiberty/ChangeLog
libiberty/argv.c

index 6073c5bfed268b5d543b7f7bb20d5fce1f3a1200..3cc90d17e9999f374dc5f3ea16fbb7b48b535630 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-05  Mike Frysinger  <vapier@gentoo.org>
+
+       * argv.c (dupargv): Replace strlen/xmalloc/strcpy with xstrdup.
+
 2015-12-28  Patrick Palka  <ppalka@gcc.gnu.org>
 
        * crc32.c: In the documentation, don't refer to GDB's
index f2727e8de95db2d849f57e690e64a9dbc08853ff..5c3dd70b0422c77076944d0266c5817c96b284a3 100644 (file)
@@ -76,11 +76,7 @@ dupargv (char **argv)
 
   /* the strings */
   for (argc = 0; argv[argc] != NULL; argc++)
-    {
-      int len = strlen (argv[argc]);
-      copy[argc] = (char *) xmalloc (len + 1);
-      strcpy (copy[argc], argv[argc]);
-    }
+    copy[argc] = xstrdup (argv[argc]);
   copy[argc] = NULL;
   return copy;
 }