]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/tui] Simplify tui_enable
authorTom de Vries <tdevries@suse.de>
Fri, 1 May 2026 16:46:09 +0000 (18:46 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 1 May 2026 16:46:09 +0000 (18:46 +0200)
I noticed some code in tui_enable doing:
...
if (...)
  error (...);
else if (...)
...
which is the "Don’t use else after a return" anti-pattern [1].

Fix this by using:
...
if (...)
  error (...);

if (...)
...

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://llvm.org/docs/CodingStandards.html#id41

gdb/tui/tui.c

index ba4f6f687697084cea1616a42cd9a018575c97bb..de2faa36af7eb844c8d0a8588abec00e4ff6138f 100644 (file)
@@ -429,7 +429,8 @@ tui_enable (void)
         again.  */
       error (_("Cannot enable the TUI"));
     }
-  else if (tui_finish_init == TRIBOOL_TRUE)
+
+  if (tui_finish_init == TRIBOOL_TRUE)
     {
       WINDOW *w;
       SCREEN *s;