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
This commit is contained in:
parent
ebd4a2097b
commit
ae120683c6
|
@ -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>
|
2015-12-28 Patrick Palka <ppalka@gcc.gnu.org>
|
||||||
|
|
||||||
* crc32.c: In the documentation, don't refer to GDB's
|
* crc32.c: In the documentation, don't refer to GDB's
|
||||||
|
|
|
@ -76,11 +76,7 @@ dupargv (char **argv)
|
||||||
|
|
||||||
/* the strings */
|
/* the strings */
|
||||||
for (argc = 0; argv[argc] != NULL; argc++)
|
for (argc = 0; argv[argc] != NULL; argc++)
|
||||||
{
|
copy[argc] = xstrdup (argv[argc]);
|
||||||
int len = strlen (argv[argc]);
|
|
||||||
copy[argc] = (char *) xmalloc (len + 1);
|
|
||||||
strcpy (copy[argc], argv[argc]);
|
|
||||||
}
|
|
||||||
copy[argc] = NULL;
|
copy[argc] = NULL;
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue