From 451dad9c5866e6317e68a7997007cb9ed27ea15a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 26 Sep 2001 01:55:19 +0000 Subject: [PATCH] * 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. --- binutils/ChangeLog | 9 +++++++++ binutils/bucomm.c | 45 ++++++++--------------------------------- binutils/objdump.c | 26 ++++++------------------ binutils/readelf.c | 50 ++++++++-------------------------------------- 4 files changed, 31 insertions(+), 99 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1b8b87c42c..6060162e62 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2001-09-26 Alan Modra + + * 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 * readelf.c (do_wide): New. diff --git a/binutils/bucomm.c b/binutils/bucomm.c index bf0f7993d3..aa3080fa75 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 5020040d26..10727e3e46 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 27c6d289eb..5ba5315fa2 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -281,61 +281,27 @@ 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; + VA_CLOSE (args); } -#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; -} - -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 *));