* 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.
This commit is contained in:
Alan Modra 2001-09-26 01:55:19 +00:00
parent 86caa542b1
commit 451dad9c58
4 changed files with 31 additions and 99 deletions

View file

@ -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.

View file

@ -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,

View file

@ -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;
}

View file

@ -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 *));