Make _bfd_error_buf static
This makes _bfd_error_buf static and adds a way to clear it. I felt that this made the subsequent patches a little cleaner. * bfd.c (_bfd_error_buf): Now static. (bfd_set_input_error): Use _bfd_clear_error_data. (_bfd_clear_error_data): New function. (bfd_init): Use _bfd_clear_error_data. * libbfd.h: Regenerate. * opncls.c (bfd_close_all_done): Use _bfd_clear_error_data. * po/bfd.pot: Regenerate.
This commit is contained in:
parent
9da76ef30c
commit
426931be4b
4 changed files with 1404 additions and 1237 deletions
30
bfd/bfd.c
30
bfd/bfd.c
|
@ -726,16 +726,12 @@ CODE_FRAGMENT
|
|||
.}
|
||||
.bfd_error_type;
|
||||
.
|
||||
INTERNAL
|
||||
.{* A buffer that is freed on bfd_close. *}
|
||||
.extern char *_bfd_error_buf;
|
||||
.
|
||||
*/
|
||||
|
||||
static bfd_error_type bfd_error;
|
||||
static bfd_error_type input_error;
|
||||
static bfd *input_bfd;
|
||||
char *_bfd_error_buf;
|
||||
static char *_bfd_error_buf;
|
||||
|
||||
const char *const bfd_errmsgs[] =
|
||||
{
|
||||
|
@ -823,8 +819,7 @@ bfd_set_input_error (bfd *input, bfd_error_type error_tag)
|
|||
/* This is an error that occurred during bfd_close when writing an
|
||||
archive, but on one of the input files. */
|
||||
bfd_error = bfd_error_on_input;
|
||||
free (_bfd_error_buf);
|
||||
_bfd_error_buf = NULL;
|
||||
_bfd_clear_error_data ();
|
||||
input_bfd = input;
|
||||
input_error = error_tag;
|
||||
if (input_error >= bfd_error_on_input)
|
||||
|
@ -896,6 +891,24 @@ bfd_perror (const char *message)
|
|||
fflush (stderr);
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
_bfd_clear_error_data
|
||||
|
||||
SYNOPSIS
|
||||
void _bfd_clear_error_data (void);
|
||||
|
||||
DESCRIPTION
|
||||
Free any data associated with the BFD error.
|
||||
*/
|
||||
|
||||
void
|
||||
_bfd_clear_error_data (void)
|
||||
{
|
||||
free (_bfd_error_buf);
|
||||
_bfd_error_buf = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_asprintf
|
||||
|
@ -1725,8 +1738,7 @@ bfd_init (void)
|
|||
{
|
||||
bfd_error = bfd_error_no_error;
|
||||
input_bfd = NULL;
|
||||
free (_bfd_error_buf);
|
||||
_bfd_error_buf = NULL;
|
||||
_bfd_clear_error_data ();
|
||||
input_error = bfd_error_no_error;
|
||||
_bfd_error_program_name = NULL;
|
||||
_bfd_error_internal = error_handler_fprintf;
|
||||
|
|
|
@ -929,8 +929,7 @@ bool bfd_write_bigendian_4byte_int (bfd *, unsigned int) ATTRIBUTE_HIDDEN;
|
|||
unsigned int bfd_log2 (bfd_vma x) ATTRIBUTE_HIDDEN;
|
||||
|
||||
/* Extracted from bfd.c. */
|
||||
/* A buffer that is freed on bfd_close. */
|
||||
extern char *_bfd_error_buf;
|
||||
void _bfd_clear_error_data (void) ATTRIBUTE_HIDDEN;
|
||||
|
||||
char *bfd_asprintf (const char *fmt, ...) ATTRIBUTE_HIDDEN;
|
||||
|
||||
|
|
|
@ -927,8 +927,7 @@ bfd_close_all_done (bfd *abfd)
|
|||
_maybe_make_executable (abfd);
|
||||
|
||||
_bfd_delete_bfd (abfd);
|
||||
free (_bfd_error_buf);
|
||||
_bfd_error_buf = NULL;
|
||||
_bfd_clear_error_data ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
2605
bfd/po/bfd.pot
2605
bfd/po/bfd.pot
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue