merge from gcc
This commit is contained in:
parent
85c774585e
commit
99ee3a8f13
|
@ -1,3 +1,7 @@
|
||||||
|
2001-09-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* libiberty.h (reconcat): New function.
|
||||||
|
|
||||||
2001-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
2001-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* libiberty.h (concat, concat_length, concat_copy, concat_copy2,
|
* libiberty.h (concat, concat_length, concat_copy, concat_copy2,
|
||||||
|
|
|
@ -91,6 +91,15 @@ extern const char *lbasename PARAMS ((const char *));
|
||||||
|
|
||||||
extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
|
extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
|
||||||
|
|
||||||
|
/* Concatenate an arbitrary number of strings. You must pass NULL as
|
||||||
|
the last argument of this function, to terminate the list of
|
||||||
|
strings. Allocates memory using xmalloc. The first argument is
|
||||||
|
not one of the strings to be concatenated, but if not NULL is a
|
||||||
|
pointer to be freed after the new string is created, similar to the
|
||||||
|
way xrealloc works. */
|
||||||
|
|
||||||
|
extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC;
|
||||||
|
|
||||||
/* Determine the length of concatenating an arbitrary number of
|
/* Determine the length of concatenating an arbitrary number of
|
||||||
strings. You must pass NULL as the last argument of this function,
|
strings. You must pass NULL as the last argument of this function,
|
||||||
to terminate the list of strings. */
|
to terminate the list of strings. */
|
||||||
|
|
|
@ -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>
|
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* concat.c (vconcat_length, vconcat_copy, concat_length,
|
* concat.c (vconcat_length, vconcat_copy, concat_length,
|
||||||
|
|
|
@ -171,6 +171,31 @@ concat VPARAMS ((const char *first, ...))
|
||||||
return newstr;
|
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
|
#ifdef MAIN
|
||||||
#define NULLP (char *)0
|
#define NULLP (char *)0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue