summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2001-09-24 23:37:52 +0000
committerDJ Delorie <dj@delorie.com>2001-09-24 23:37:52 +0000
commit96c0df56b29a4eeac6f225dd0ea5a051e2d68a2c (patch)
tree9e77a13d4e3273a159b3149ffdfeca009fb21825 /libiberty
parentdf4d069373b8ff29236f83d2c8af2777e20a8c8b (diff)
downloadbinutils-redhat-96c0df56b29a4eeac6f225dd0ea5a051e2d68a2c.tar.gz
merge from gcc
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libiberty/concat.c25
2 files changed, 29 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index d9dc3dcb8b..22bf58cfad 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * concat.c (reconcat): New function.
+
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* concat.c (vconcat_length, vconcat_copy, concat_length,
diff --git a/libiberty/concat.c b/libiberty/concat.c
index feed0df819..136e8be866 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