Remove NULL check from tui_set_exec_info_content
authorTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 23:51:01 +0000 (17:51 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 25 Jun 2019 13:48:39 +0000 (07:48 -0600)
tui_set_exec_info_content ensures that the window's "execution_info"
is allocated, so the NULL check here is redundant and can be removed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_set_exec_info_content): Remove NULL
check.

gdb/ChangeLog
gdb/tui/tui-winsource.c

index a97cfde736d8af85a0446080a91b9ce6e0de98e8..feec185ffb2f602484548f874ddd4ed2b0107567 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-25  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-winsource.c (tui_set_exec_info_content): Remove NULL
+       check.
+
 2019-06-25  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-winsource.h (tui_alloc_source_buffer): Change return
index 209d33d6c998e1f9dcd5883d92d54d3c644cade1..5e60e9e37266340af30d4c0f6ac39cf15e4cd4f0 100644 (file)
@@ -495,46 +495,40 @@ tui_set_exec_info_content (struct tui_win_info *win_info)
       if (exec_info_ptr->content == NULL)
        exec_info_ptr->content =
          tui_alloc_content (win_info->height, exec_info_ptr->type);
-      if (exec_info_ptr->content != NULL)
-       {
-         int i;
 
-          tui_update_breakpoint_info (win_info, 1);
-         for (i = 0; i < win_info->content_size; i++)
-           {
-             struct tui_win_element *element;
-             struct tui_win_element *src_element;
-              int mode;
-
-             element = exec_info_ptr->content[i];
-             src_element = win_info->content[i];
-
-              memset(element->which_element.simple_string, ' ',
-                     sizeof(element->which_element.simple_string));
-              element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0;
-
-             /* Now update the exec info content based upon the state
-                 of each line as indicated by the source content.  */
-              mode = src_element->which_element.source.has_break;
-              if (mode & TUI_BP_HIT)
-                element->which_element.simple_string[TUI_BP_HIT_POS] =
-                  (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
-              else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
-                element->which_element.simple_string[TUI_BP_HIT_POS] =
-                  (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
-
-              if (mode & TUI_BP_ENABLED)
-                element->which_element.simple_string[TUI_BP_BREAK_POS] = '+';
-              else if (mode & TUI_BP_DISABLED)
-                element->which_element.simple_string[TUI_BP_BREAK_POS] = '-';
-
-              if (src_element->which_element.source.is_exec_point)
-                element->which_element.simple_string[TUI_EXEC_POS] = '>';
-           }
-         exec_info_ptr->content_size = win_info->content_size;
+      tui_update_breakpoint_info (win_info, 1);
+      for (int i = 0; i < win_info->content_size; i++)
+       {
+         struct tui_win_element *element;
+         struct tui_win_element *src_element;
+         int mode;
+
+         element = exec_info_ptr->content[i];
+         src_element = win_info->content[i];
+
+         memset(element->which_element.simple_string, ' ',
+                sizeof(element->which_element.simple_string));
+         element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0;
+
+         /* Now update the exec info content based upon the state
+            of each line as indicated by the source content.  */
+         mode = src_element->which_element.source.has_break;
+         if (mode & TUI_BP_HIT)
+           element->which_element.simple_string[TUI_BP_HIT_POS] =
+             (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
+         else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
+           element->which_element.simple_string[TUI_BP_HIT_POS] =
+             (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
+
+         if (mode & TUI_BP_ENABLED)
+           element->which_element.simple_string[TUI_BP_BREAK_POS] = '+';
+         else if (mode & TUI_BP_DISABLED)
+           element->which_element.simple_string[TUI_BP_BREAK_POS] = '-';
+
+         if (src_element->which_element.source.is_exec_point)
+           element->which_element.simple_string[TUI_EXEC_POS] = '>';
        }
-      else
-       ret = TUI_FAILURE;
+      exec_info_ptr->content_size = win_info->content_size;
     }
 
   return ret;