summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorvapier <vapier@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-05 19:55:21 +0000
committervapier <vapier@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-05 19:55:21 +0000
commite1bacdb6f1e925381a2bf22432e9158f4df6d3f7 (patch)
treeeff165c07f714a1fe61c3b1f1e177ee494c3fb84 /libiberty
parenta65992fe36eed4ee4164e3341fe78988d540f4cf (diff)
downloadgcc-e1bacdb6f1e925381a2bf22432e9158f4df6d3f7.tar.gz
libiberty: dupargv: rewrite to use xstrdup
This func is basically open coding the xstrdup function, so gut it and use that directly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libiberty/argv.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 6073c5bfed2..3cc90d17e99 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -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
diff --git a/libiberty/argv.c b/libiberty/argv.c
index f2727e8de95..5c3dd70b042 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;
}