diff options
author | Alan Modra <amodra@gmail.com> | 2020-05-20 22:50:49 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-05-21 10:45:33 +0930 |
commit | 5e2ab6125485bede5611187f2df4b26b04026b80 (patch) | |
tree | f3884cb27e8761b535ee38e63ebee33c5cdbfea4 /ld/deffilep.y | |
parent | 3d45296946ba5c0ff59c407029bee3f368cace00 (diff) | |
download | gdb-5e2ab6125485bede5611187f2df4b26b04026b80.zip gdb-5e2ab6125485bede5611187f2df4b26b04026b80.tar.gz gdb-5e2ab6125485bede5611187f2df4b26b04026b80.tar.bz2 |
Replace "if (x) free (x)" with "free (x)", ld
* deffilep.y: Replace "if (x) free (x)" with "free (x)" thoughout.
* emultempl/elf.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* ldelf.c: Likewise.
* ldfile.c: Likewise.
* ldmain.c: Likewise.
* ldmisc.c: Likewise.
* lexsup.c: Likewise.
* pe-dll.c: Likewise.
Diffstat (limited to 'ld/deffilep.y')
-rw-r--r-- | ld/deffilep.y | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/ld/deffilep.y b/ld/deffilep.y index b9105d4..51cb1d7 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -434,19 +434,15 @@ def_file_free (def_file *fdef) if (!fdef) return; - if (fdef->name) - free (fdef->name); - if (fdef->description) - free (fdef->description); + free (fdef->name); + free (fdef->description); if (fdef->section_defs) { for (i = 0; i < fdef->num_section_defs; i++) { - if (fdef->section_defs[i].name) - free (fdef->section_defs[i].name); - if (fdef->section_defs[i].class) - free (fdef->section_defs[i].class); + free (fdef->section_defs[i].name); + free (fdef->section_defs[i].class); } free (fdef->section_defs); } @@ -455,13 +451,10 @@ def_file_free (def_file *fdef) { for (i = 0; i < fdef->num_exports; i++) { - if (fdef->exports[i].internal_name - && fdef->exports[i].internal_name != fdef->exports[i].name) + if (fdef->exports[i].internal_name != fdef->exports[i].name) free (fdef->exports[i].internal_name); - if (fdef->exports[i].name) - free (fdef->exports[i].name); - if (fdef->exports[i].its_name) - free (fdef->exports[i].its_name); + free (fdef->exports[i].name); + free (fdef->exports[i].its_name); } free (fdef->exports); } @@ -470,13 +463,10 @@ def_file_free (def_file *fdef) { for (i = 0; i < fdef->num_imports; i++) { - if (fdef->imports[i].internal_name - && fdef->imports[i].internal_name != fdef->imports[i].name) + if (fdef->imports[i].internal_name != fdef->imports[i].name) free (fdef->imports[i].internal_name); - if (fdef->imports[i].name) - free (fdef->imports[i].name); - if (fdef->imports[i].its_name) - free (fdef->imports[i].its_name); + free (fdef->imports[i].name); + free (fdef->imports[i].its_name); } free (fdef->imports); } @@ -1049,8 +1039,7 @@ def_image_name (const char *name, bfd_vma base, int is_dll) einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n", def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", name); - if (def->name) - free (def->name); + free (def->name); /* Append the default suffix, if none specified. */ if (strchr (image_name, '.') == 0) { |