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/emultempl | |
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/emultempl')
-rw-r--r-- | ld/emultempl/elf.em | 7 | ||||
-rw-r--r-- | ld/emultempl/msp430.em | 3 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 7 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 7 | ||||
-rw-r--r-- | ld/emultempl/ppc64elf.em | 3 | ||||
-rw-r--r-- | ld/emultempl/xtensaelf.em | 19 |
6 files changed, 14 insertions, 32 deletions
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index eac2ce2..4fd6fdf 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -620,11 +620,8 @@ gld${EMULATION_NAME}_handle_option (int optc) return FALSE; case OPTION_BUILD_ID: - if (ldelf_emit_note_gnu_build_id != NULL) - { - free ((char *) ldelf_emit_note_gnu_build_id); - ldelf_emit_note_gnu_build_id = NULL; - } + free ((char *) ldelf_emit_note_gnu_build_id); + ldelf_emit_note_gnu_build_id = NULL; if (optarg == NULL) optarg = DEFAULT_BUILD_ID_STYLE; if (strcmp (optarg, "none")) diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em index 850c3a8..c823a6d 100644 --- a/ld/emultempl/msp430.em +++ b/ld/emultempl/msp430.em @@ -330,8 +330,7 @@ gld${EMULATION_NAME}_place_orphan (asection * s, end: free (upper_name); free (lower_name); - if (buf) - free (buf); + free (buf); return lower; } EOF diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 8c5ee76..3899c9d 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -884,11 +884,8 @@ gld${EMULATION_NAME}_handle_option (int optc) pe_dll_characteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE; break; case OPTION_BUILD_ID: - if (emit_build_id != NULL) - { - free ((char *) emit_build_id); - emit_build_id = NULL; - } + free ((char *) emit_build_id); + emit_build_id = NULL; if (optarg == NULL) optarg = DEFAULT_BUILD_ID_STYLE; if (strcmp (optarg, "none")) diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index ea8e768..a0a7023 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -831,11 +831,8 @@ gld${EMULATION_NAME}_handle_option (int optc) pe_dll_characteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE; break; case OPTION_BUILD_ID: - if (emit_build_id != NULL) - { - free ((char *) emit_build_id); - emit_build_id = NULL; - } + free ((char *) emit_build_id); + emit_build_id = NULL; if (optarg == NULL) optarg = DEFAULT_BUILD_ID_STYLE; if (strcmp (optarg, "none")) diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 6633f81..a2834c8 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -602,8 +602,7 @@ gld${EMULATION_NAME}_finish (void) fprintf (stderr, "%s: %s\n", program_name, line); } fflush (stderr); - if (msg != NULL) - free (msg); + free (msg); finish_default (); } diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em index 2d9f594..932721c 100644 --- a/ld/emultempl/xtensaelf.em +++ b/ld/emultempl/xtensaelf.em @@ -216,18 +216,15 @@ replace_insn_sec_with_prop_sec (bfd *abfd, remove_section (abfd, insn_sec); - if (insn_contents) - free (insn_contents); + free (insn_contents); return TRUE; cleanup: if (prop_sec && prop_sec->owner) remove_section (abfd, prop_sec); - if (insn_contents) - free (insn_contents); - if (internal_relocs) - free (internal_relocs); + free (insn_contents); + free (internal_relocs); return FALSE; } @@ -271,8 +268,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec) insn_sec_name, abfd, message); } } - if (owned_prop_sec_name) - free (owned_prop_sec_name); + free (owned_prop_sec_name); } @@ -636,8 +632,7 @@ xtensa_append_section_deps (reloc_deps_graph *deps, asection *sec) { new_sections[i] = deps->sections[i]; } - if (deps->sections != NULL) - free (deps->sections); + free (deps->sections); deps->sections = new_sections; deps->size = new_size; } @@ -675,9 +670,7 @@ free_reloc_deps_graph (reloc_deps_graph *deps) } xtensa_set_section_deps (deps, sec, NULL); } - if (deps->sections) - free (deps->sections); - + free (deps->sections); free (deps); } |