diff options
author | DJ Delorie <dj@redhat.com> | 2001-08-27 20:05:03 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2001-08-27 20:05:03 +0000 |
commit | 8a423cb3d62534f6663b66ae42045fd984d36d63 (patch) | |
tree | b55408216c31718273ce78d51a71ad5e06431b52 /libiberty/concat.c | |
parent | 7283eb8605a152788f7748a5ae9f21eafc23c62e (diff) | |
download | gdb-8a423cb3d62534f6663b66ae42045fd984d36d63.zip gdb-8a423cb3d62534f6663b66ae42045fd984d36d63.tar.gz gdb-8a423cb3d62534f6663b66ae42045fd984d36d63.tar.bz2 |
merge from gcc
Diffstat (limited to 'libiberty/concat.c')
-rw-r--r-- | libiberty/concat.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/libiberty/concat.c b/libiberty/concat.c index 01270ea..2e31e83 100644 --- a/libiberty/concat.c +++ b/libiberty/concat.c @@ -74,48 +74,29 @@ NOTES # endif # endif -/* VARARGS */ -#ifdef ANSI_PROTOTYPES -char * -concat (const char *first, ...) -#else char * -concat (va_alist) - va_dcl -#endif +concat VPARAMS ((const char *first, ...)) { register size_t length; register char *newstr; register char *end; register const char *arg; - va_list args; -#ifndef ANSI_PROTOTYPES - const char *first; -#endif /* First compute the size of the result and get sufficient memory. */ -#ifdef ANSI_PROTOTYPES - va_start (args, first); -#else - va_start (args); - first = va_arg (args, const char *); -#endif - + VA_OPEN (args, first); + VA_FIXEDARG (args, const char *, first); + length = 0; for (arg = first; arg ; arg = va_arg (args, const char *)) length += strlen (arg); - va_end (args); + VA_CLOSE (args); newstr = (char *) xmalloc (length + 1); /* Now copy the individual pieces to the result string. */ -#ifdef ANSI_PROTOTYPES - va_start (args, first); -#else - va_start (args); - first = va_arg (args, const char *); -#endif + VA_OPEN (args, first); + VA_FIXEDARG (args, const char *, first); end = newstr; for (arg = first; arg ; arg = va_arg (args, const char *)) @@ -125,7 +106,7 @@ concat (va_alist) end += length; } *end = '\000'; - va_end (args); + VA_CLOSE (args); return newstr; } |