aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binutils/ChangeLog9
-rw-r--r--binutils/bucomm.c45
-rw-r--r--binutils/objdump.c26
-rw-r--r--binutils/readelf.c50
4 files changed, 31 insertions, 99 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 1b8b87c..6060162 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-26 Alan Modra <amodra@bigpond.net.au>
+
+ * bucomm.c (fatal): Define using VPARAMS, VA_OPEN, VA_FIXEDARG,
+ VA_CLOSE.
+ (non_fatal): Likewise.
+ * objdump.c (objdump_sprintf): Likewise.
+ * readelf.c (error): Likewise.
+ (warn): Likewise.
+
2001-09-25 Jakub Jelinek <jakub@redhat.com>
* readelf.c (do_wide): New.
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index bf0f799..aa3080f 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -70,55 +70,26 @@ report (format, args)
putc ('\n', stderr);
}
-#ifdef ANSI_PROTOTYPES
void
-fatal (const char *format, ...)
+fatal VPARAMS ((const char *format, ...))
{
- va_list args;
+ VA_OPEN (args, format);
+ VA_FIXEDARG (args, const char *, format);
- va_start (args, format);
report (format, args);
- va_end (args);
+ VA_CLOSE (args);
xexit (1);
}
void
-non_fatal (const char *format, ...)
+non_fatal VPARAMS ((const char *format, ...))
{
- va_list args;
+ VA_OPEN (args, format);
+ VA_FIXEDARG (args, const char *, format);
- va_start (args, format);
report (format, args);
- va_end (args);
+ VA_CLOSE (args);
}
-#else
-void
-fatal (va_alist)
- va_dcl
-{
- char *Format;
- va_list args;
-
- va_start (args);
- Format = va_arg (args, char *);
- report (Format, args);
- va_end (args);
- xexit (1);
-}
-
-void
-non_fatal (va_alist)
- va_dcl
-{
- char *Format;
- va_list args;
-
- va_start (args);
- Format = va_arg (args, char *);
- report (Format, args);
- va_end (args);
-}
-#endif
/* Set the default BFD target based on the configured target. Doing
this permits the binutils to be configured for a particular target,
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 5020040..10727e3 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1109,35 +1109,20 @@ typedef struct
/* sprintf to a "stream" */
static int
-#ifdef ANSI_PROTOTYPES
-objdump_sprintf (SFILE *f, const char *format, ...)
-#else
-objdump_sprintf (va_alist)
- va_dcl
-#endif
+objdump_sprintf VPARAMS ((SFILE *f, const char *format, ...))
{
-#ifndef ANSI_PROTOTYPES
- SFILE *f;
- const char *format;
-#endif
char *buf;
- va_list args;
size_t n;
-#ifdef ANSI_PROTOTYPES
- va_start (args, format);
-#else
- va_start (args);
- f = va_arg (args, SFILE *);
- format = va_arg (args, const char *);
-#endif
+ VA_OPEN (args, format);
+ VA_FIXEDARG (args, SFILE *, f);
+ VA_FIXEDARG (args, const char *, format);
vasprintf (&buf, format, args);
- va_end (args);
-
if (buf == NULL)
{
+ va_end (args);
fatal (_("Out of virtual memory"));
}
@@ -1159,6 +1144,7 @@ objdump_sprintf (va_alist)
free (buf);
+ VA_CLOSE (args);
return n;
}
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 27c6d28..5ba5315 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -281,62 +281,28 @@ typedef int Elf32_Word;
: get_64bit_elf_symbols (file, offset, size))
-#ifdef ANSI_PROTOTYPES
static void
-error (const char * message, ...)
+error VPARAMS ((const char *message, ...))
{
- va_list args;
+ VA_OPEN (args, message);
+ VA_FIXEDARG (args, const char *, message);
fprintf (stderr, _("%s: Error: "), program_name);
- va_start (args, message);
vfprintf (stderr, message, args);
- va_end (args);
- return;
+ VA_CLOSE (args);
}
static void
-warn (const char * message, ...)
+warn VPARAMS ((const char *message, ...))
{
- va_list args;
+ VA_OPEN (args, message);
+ VA_FIXEDARG (args, const char *, message);
fprintf (stderr, _("%s: Warning: "), program_name);
- va_start (args, message);
- vfprintf (stderr, message, args);
- va_end (args);
- return;
-}
-#else
-static void
-error (va_alist)
- va_dcl
-{
- char * message;
- va_list args;
-
- fprintf (stderr, _("%s: Error: "), program_name);
- va_start (args);
- message = va_arg (args, char *);
vfprintf (stderr, message, args);
- va_end (args);
- return;
+ VA_CLOSE (args);
}
-static void
-warn (va_alist)
- va_dcl
-{
- char * message;
- va_list args;
-
- fprintf (stderr, _("%s: Warning: "), program_name);
- va_start (args);
- message = va_arg (args, char *);
- vfprintf (stderr, message, args);
- va_end (args);
- return;
-}
-#endif
-
static PTR get_data PARAMS ((PTR, FILE *, long, size_t, const char *));
static PTR