aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-05-20 17:25:20 +0930
committerAlan Modra <amodra@gmail.com>2020-05-21 10:11:57 +0930
commitc95949892f6f1e2974a0fb8a5463d7b6432ac469 (patch)
tree787ac00de8dc1bfb5170e2b2caf05e66d8ab6c7f /bfd/aoutx.h
parentc31ab5a0010ac9e3d31fd218fffcff1b9696363e (diff)
downloadbinutils-c95949892f6f1e2974a0fb8a5463d7b6432ac469.zip
binutils-c95949892f6f1e2974a0fb8a5463d7b6432ac469.tar.gz
binutils-c95949892f6f1e2974a0fb8a5463d7b6432ac469.tar.bz2
Replace "if (x) free (x)" with "free (x)", bfd
* aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout. * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c, * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c, * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c, * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c, * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c, * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h, * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c, * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c, * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c, * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h46
1 files changed, 15 insertions, 31 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 4cf5713..08083c1 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -2816,8 +2816,7 @@ NAME (aout, find_nearest_line) (bfd *abfd,
else
funclen = strlen (bfd_asymbol_name (func));
- if (adata (abfd).line_buf != NULL)
- free (adata (abfd).line_buf);
+ free (adata (abfd).line_buf);
if (filelen + funclen == 0)
adata (abfd).line_buf = buf = NULL;
@@ -2899,7 +2898,7 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd)
|| abfd->tdata.aout_data == NULL)
return TRUE;
-#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
+#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (obj_aout_symbols (abfd));
#ifdef USE_MMAP
obj_aout_external_syms (abfd) = 0;
@@ -5617,26 +5616,15 @@ NAME (aout, final_link) (bfd *abfd,
}
}
- if (aout_info.contents != NULL)
- {
- free (aout_info.contents);
- aout_info.contents = NULL;
- }
- if (aout_info.relocs != NULL)
- {
- free (aout_info.relocs);
- aout_info.relocs = NULL;
- }
- if (aout_info.symbol_map != NULL)
- {
- free (aout_info.symbol_map);
- aout_info.symbol_map = NULL;
- }
- if (aout_info.output_syms != NULL)
- {
- free (aout_info.output_syms);
- aout_info.output_syms = NULL;
- }
+ free (aout_info.contents);
+ aout_info.contents = NULL;
+ free (aout_info.relocs);
+ aout_info.relocs = NULL;
+ free (aout_info.symbol_map);
+ aout_info.symbol_map = NULL;
+ free (aout_info.output_syms);
+ aout_info.output_syms = NULL;
+
if (includes_hash_initialized)
{
bfd_hash_table_free (&aout_info.includes.root);
@@ -5679,14 +5667,10 @@ NAME (aout, final_link) (bfd *abfd,
return TRUE;
error_return:
- if (aout_info.contents != NULL)
- free (aout_info.contents);
- if (aout_info.relocs != NULL)
- free (aout_info.relocs);
- if (aout_info.symbol_map != NULL)
- free (aout_info.symbol_map);
- if (aout_info.output_syms != NULL)
- free (aout_info.output_syms);
+ free (aout_info.contents);
+ free (aout_info.relocs);
+ free (aout_info.symbol_map);
+ free (aout_info.output_syms);
if (includes_hash_initialized)
bfd_hash_table_free (&aout_info.includes.root);
return FALSE;