public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove NULL checks before xfree
@ 2019-06-25 14:03 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-06-25 14:03 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=17568d782d96434537fe9698c5ebcb09f35c20cb
commit 17568d782d96434537fe9698c5ebcb09f35c20cb
Author: Tom Tromey <tom@tromey.com>
Date: Sun Jun 23 14:28:11 2019 -0600
Remove NULL checks before xfree
A couple of spots in the TUI did a NULL check before an xfree. This
isn't necessary, and most other cases were removed from gdb a while
ago.
gdb/ChangeLog
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-source.c (tui_set_source_content): Don't check before
xfree.
* tui/tui-disasm.c (tui_disassemble): Don't check before xfree.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/tui/tui-disasm.c | 6 ++----
gdb/tui/tui-source.c | 3 +--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2e64124..9898bcd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2019-06-25 Tom Tromey <tom@tromey.com>
+ * tui/tui-source.c (tui_set_source_content): Don't check before
+ xfree.
+ * tui/tui-disasm.c (tui_disassemble): Don't check before xfree.
+
+2019-06-25 Tom Tromey <tom@tromey.com>
+
* tui/tui-winsource.h (tui_update_source_window_as_is)
(tui_alloc_source_buffer, tui_line_is_displayed)
(tui_addr_is_displayed): Change type of win_info.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index d3d53d7..4899b1d 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -59,10 +59,8 @@ tui_disassemble (struct gdbarch *gdbarch, struct tui_asm_line *asm_lines,
/* Now construct each line. */
for (; count > 0; count--, asm_lines++)
{
- if (asm_lines->addr_string)
- xfree (asm_lines->addr_string);
- if (asm_lines->insn)
- xfree (asm_lines->insn);
+ xfree (asm_lines->addr_string);
+ xfree (asm_lines->insn);
print_address (gdbarch, pc, &gdb_dis_out);
asm_lines->addr = pc;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 4f82cba..889b950 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -163,8 +163,7 @@ tui_set_source_content (struct symtab *s,
= (struct tui_source_window_base *) TUI_SRC_WIN;
const char *s_filename = symtab_to_filename_for_display (s);
- if (TUI_SRC_WIN->title)
- xfree (TUI_SRC_WIN->title);
+ xfree (TUI_SRC_WIN->title);
TUI_SRC_WIN->title = xstrdup (s_filename);
xfree (src->fullname);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-25 14:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 14:03 [binutils-gdb] Remove NULL checks before xfree Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).