aboutsummaryrefslogtreecommitdiff
path: root/libiberty/concat.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2001-09-24 23:37:52 +0000
committerDJ Delorie <dj@redhat.com>2001-09-24 23:37:52 +0000
commit99ee3a8f13fc032cce1b964cdbc37a567a944428 (patch)
tree5d45bddd294f7179dab19c01ac180edd28acbd95 /libiberty/concat.c
parent85c774585e45889b3ce15d370b374fbadc878e54 (diff)
downloadbinutils-99ee3a8f13fc032cce1b964cdbc37a567a944428.zip
binutils-99ee3a8f13fc032cce1b964cdbc37a567a944428.tar.gz
binutils-99ee3a8f13fc032cce1b964cdbc37a567a944428.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/concat.c')
-rw-r--r--libiberty/concat.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libiberty/concat.c b/libiberty/concat.c
index feed0df..136e8be 100644
--- a/libiberty/concat.c
+++ b/libiberty/concat.c
@@ -171,6 +171,31 @@ concat VPARAMS ((const char *first, ...))
return newstr;
}
+char *
+reconcat VPARAMS ((char *optr, const char *first, ...))
+{
+ char *newstr;
+
+ /* First compute the size of the result and get sufficient memory. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, char *, optr);
+ VA_FIXEDARG (args, const char *, first);
+ newstr = (char *) xmalloc (vconcat_length (first, args) + 1);
+ VA_CLOSE (args);
+
+ /* Now copy the individual pieces to the result string. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, char *, optr);
+ VA_FIXEDARG (args, const char *, first);
+ vconcat_copy (newstr, first, args);
+ VA_CLOSE (args);
+
+ if (optr)
+ free (optr);
+
+ return newstr;
+}
+
#ifdef MAIN
#define NULLP (char *)0