aboutsummaryrefslogtreecommitdiff
path: root/libiberty/vasprintf.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2001-09-04 21:33:56 +0000
committerDJ Delorie <dj@redhat.com>2001-09-04 21:33:56 +0000
commit843f21be9e7bc8a61562440f33e9f49d071dafe1 (patch)
tree06dc574d023f069060006225f669844de6bf7392 /libiberty/vasprintf.c
parent5907e6285ec51809f82011f923cc675c26c956cf (diff)
downloadgdb-843f21be9e7bc8a61562440f33e9f49d071dafe1.zip
gdb-843f21be9e7bc8a61562440f33e9f49d071dafe1.tar.gz
gdb-843f21be9e7bc8a61562440f33e9f49d071dafe1.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/vasprintf.c')
-rw-r--r--libiberty/vasprintf.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
index c34585d..32faa84 100644
--- a/libiberty/vasprintf.c
+++ b/libiberty/vasprintf.c
@@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA. */
#include <varargs.h>
#endif
#include <stdio.h>
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
@@ -142,29 +144,22 @@ vasprintf (result, format, args)
}
#ifdef TEST
-static void checkit PARAMS ((const char *, ...));
-
-static void
-checkit VPARAMS ((const char* format, ...))
+static void ATTRIBUTE_PRINTF_1
+checkit VPARAMS ((const char *format, ...))
{
- va_list args;
char *result;
-#ifndef ANSI_PROTOTYPES
- const char *format;
-#endif
-
- VA_START (args, format);
-
-#ifndef ANSI_PROTOTYPES
- format = va_arg (args, const char *);
-#endif
-
+ VA_OPEN (args, format);
+ VA_FIXEDARG (args, const char *, format);
vasprintf (&result, format, args);
+ VA_CLOSE (args);
+
if (strlen (result) < (size_t) global_total_width)
printf ("PASS: ");
else
printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result);
+
+ free (result);
}
extern int main PARAMS ((void));