diff options
author | Nick Clifton <nickc@redhat.com> | 2021-05-04 14:29:04 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-05-04 14:29:04 +0100 |
commit | bd6d8601f304d03ecdebe1b1a7d48666845a91aa (patch) | |
tree | 5880baf07238e954bd33f97c546dbabb3070dc7f /bfd/libbfd.h | |
parent | a8d6316b67d52eaa1b7b311084ddff71a66f7cc0 (diff) | |
download | gdb-bd6d8601f304d03ecdebe1b1a7d48666845a91aa.zip gdb-bd6d8601f304d03ecdebe1b1a7d48666845a91aa.tar.gz gdb-bd6d8601f304d03ecdebe1b1a7d48666845a91aa.tar.bz2 |
Define bfd_realloc(ptr,0) to return allocated memory, whilst bfd_realloc_or_free(ptr,0) frees ptr.
* libbfd.c (bfd_malloc): Provide some documenation. Treat a size
of 0 as 1.
(bfd_realloc): Likewise.
(bfd_zmalloc): Likewise.
(bfd_realloc_or_free): Provide some documentation. Treat a size
of 0 as a request to free.
* libbfd-in.h (bfd_realloc): Remove prototype.
(bfd_realloc_or_free): Remove prototype.
(bfd_zmalloc): Remove prototype.
* libbfd.h: Regenerate.
Diffstat (limited to 'bfd/libbfd.h')
-rw-r--r-- | bfd/libbfd.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h index fba2999..f3a32fa 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -115,12 +115,6 @@ struct areltdata extern void *bfd_malloc (bfd_size_type) ATTRIBUTE_HIDDEN; -extern void *bfd_realloc - (void *, bfd_size_type) ATTRIBUTE_HIDDEN; -extern void *bfd_realloc_or_free - (void *, bfd_size_type) ATTRIBUTE_HIDDEN; -extern void *bfd_zmalloc - (bfd_size_type) ATTRIBUTE_HIDDEN; static inline char * bfd_strdup (const char *str) @@ -966,6 +960,14 @@ _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) return NULL; } /* Extracted from libbfd.c. */ +extern void * bfd_malloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN; + +extern void * bfd_realloc (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN; + +extern void * bfd_realloc_or_free (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN; + +extern void * bfd_zmalloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN; + bool bfd_write_bigendian_4byte_int (bfd *, unsigned int); unsigned int bfd_log2 (bfd_vma x); |