From: Mike Frysinger Date: Tue, 5 Jan 2016 19:55:21 +0000 (+0000) Subject: libiberty: dupargv: rewrite to use xstrdup X-Git-Tag: basepoints/gcc-7~1816 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae120683c6a300fecd8b82ef2451faec3932688e;p=thirdparty%2Fgcc.git libiberty: dupargv: rewrite to use xstrdup This func is basically open coding the xstrdup function, so gut it and use that directly. From-SVN: r232086 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 6073c5bfed26..3cc90d17e999 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2016-01-05 Mike Frysinger + + * argv.c (dupargv): Replace strlen/xmalloc/strcpy with xstrdup. + 2015-12-28 Patrick Palka * crc32.c: In the documentation, don't refer to GDB's diff --git a/libiberty/argv.c b/libiberty/argv.c index f2727e8de95d..5c3dd70b0422 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -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; }