This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[FYI] Remove unnecessary casts of NULL


I noticed some unnecessary casts of NULL.  This removes all the
unnecessary ones, leaving only ones where we must ensure that NULL has
pointer type for passing through varargs.

I removed a couple of useless casts of 0 that I noticed while writing
this.

Tested by rebuilding.

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

	* valops.c (value_cast, value_slice): Remove unnecessary cast.
	* breakpoint.c (stopin_command, stopat_command)
	(until_break_command, decode_location_default): Remove unnecessary
	cast.
	* utils.c (subset_compare): Remove unnecessary cast.
	* ada-lang.c (ada_update_initial_language): Remove unnecessary
	cast.
	* linespec.c (decode_line_with_last_displayed): Remove unnecessary
	cast.
	* infcmd.c (path_command): Remove unnecessary cast.
	* coffread.c (decode_type): Remove unnecessary cast.
	* xcoffread.c (read_xcoff_symtab): Remove unnecessary cast.
	* mipsread.c (mipscoff_symfile_read): Remove unnecessary cast.
	* tui/tui-stack.c (tui_show_locator_content)
	(tui_show_frame_info): Remove unnecessary cast.
	* tui/tui-win.c (tui_scroll_forward_command)
	(tui_scroll_backward_command, tui_set_focus, tui_set_win_height)
	(parse_scrolling_args): Remove unnecessary cast.
	* tui/tui-data.c (init_win_info, tui_del_window)
	(tui_free_window, tui_del_data_windows, tui_free_data_content)
	(free_content_elements): Remove unnecessary cast.
	* tui/tui-windata.c (tui_first_data_item_displayed): Remove
	unnecessary cast.
	* tui/tui-source.c (tui_set_source_content)
	(tui_vertical_source_scroll): Remove unnecessary cast.
	* tui/tui-layout.c (tui_default_win_height): Remove unnecessary
	cast.
	* tui/tui-io.c (tui_initialize_io): Remove unnecessary cast.
	* tui/tui-regs.c (tui_display_registers_from)
	(tui_display_register): Remove unnecessary cast.
	* tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win)
	(tui_unhighlight_win, tui_highlight_win, tui_make_window)
	(make_visible): Remove unnecessary cast.
	* tui/tui-winsource.c (tui_erase_source_content)
	(tui_update_breakpoint_info, tui_set_exec_info_content): Remove
	unnecessary cast.
	* ax-gdb.c (agent_command_1): Remove unnecessary cast.
	* cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast.
	* stabsread.c (read_type, read_array_type, read_range_type):
	Remove unnecessary cast.
	* mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast.
	(parse_symbol, parse_type, upgrade_type, parse_external)
	(parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove
	unnecessary cast.
	* gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
---
 gdb/ChangeLog            | 48 ++++++++++++++++++++++++++++++++++++++++
 gdb/ada-lang.c           |  3 +--
 gdb/ax-gdb.c             |  2 +-
 gdb/breakpoint.c         |  9 ++++----
 gdb/cli/cli-setshow.c    |  2 +-
 gdb/coffread.c           |  6 ++---
 gdb/gdb_bfd.c            |  2 +-
 gdb/infcmd.c             |  2 +-
 gdb/linespec.c           |  3 +--
 gdb/mdebugread.c         | 41 +++++++++++++++++-----------------
 gdb/mipsread.c           |  2 +-
 gdb/stabsread.c          |  6 ++---
 gdb/tui/tui-data.c       | 19 ++++++++--------
 gdb/tui/tui-io.c         |  2 +-
 gdb/tui/tui-layout.c     |  2 +-
 gdb/tui/tui-regs.c       |  6 ++---
 gdb/tui/tui-source.c     |  4 ++--
 gdb/tui/tui-stack.c      |  5 ++---
 gdb/tui/tui-win.c        | 12 +++++-----
 gdb/tui/tui-windata.c    |  2 +-
 gdb/tui/tui-wingeneral.c | 14 ++++++------
 gdb/tui/tui-winsource.c  |  7 +++---
 gdb/utils.c              |  2 +-
 gdb/valops.c             |  8 +++----
 gdb/xcoffread.c          | 11 +++++----
 25 files changed, 128 insertions(+), 92 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1b5f18316fa..bf17c67f4d0 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -872,8 +872,7 @@ ada_get_decoded_type (struct type *type)
 enum language
 ada_update_initial_language (enum language lang)
 {
-  if (lookup_minimal_symbol ("adainit", (const char *) NULL,
-                             (struct objfile *) NULL).minsym != NULL)
+  if (lookup_minimal_symbol ("adainit", NULL, NULL).minsym != NULL)
     return language_ada;
 
   return lang;
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 5872bec4777..d3eb4cb53ae 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2637,7 +2637,7 @@ agent_command_1 (const char *exp, int eval)
       event_location_up location
 	= new_linespec_location (&exp, symbol_name_match_type::WILD);
       decode_line_full (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
-			(struct symtab *) NULL, 0, &canonical,
+			NULL, 0, &canonical,
 			NULL, NULL);
       exp = skip_spaces (exp);
       if (exp[0] == ',')
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ccd778b7a13..8422db8b571 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9493,7 +9493,7 @@ stopin_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
-  if (arg == (char *) NULL)
+  if (arg == NULL)
     badInput = 1;
   else if (*arg != '*')
     {
@@ -9526,7 +9526,7 @@ stopat_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
-  if (arg == (char *) NULL || *arg == '*')	/* no line number */
+  if (arg == NULL || *arg == '*')	/* no line number */
     badInput = 1;
   else
     {
@@ -11015,7 +11015,7 @@ until_break_command (const char *arg, int from_tty, int anywhere)
 			get_last_displayed_symtab (),
 			get_last_displayed_line ())
        : decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
-			NULL, (struct symtab *) NULL, 0));
+			NULL, NULL, 0));
 
   if (sals.size () != 1)
     error (_("Couldn't get information on specified line."));
@@ -13730,8 +13730,7 @@ decode_location_default (struct breakpoint *b,
   struct linespec_result canonical;
 
   decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, search_pspace,
-		    (struct symtab *) NULL, 0,
-		    &canonical, multiple_symbols_all,
+		    NULL, 0, &canonical, multiple_symbols_all,
 		    b->filter);
 
   /* We should get 0 or 1 resulting SALs.  */
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 8199fa7c0b0..d588d04ab17 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -756,7 +756,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix)
 	      uiout->field_string ("name", list->name);
 	      uiout->text (":  ");
 	      if (list->type == show_cmd)
-		do_show_command ((char *) NULL, from_tty, list);
+		do_show_command (NULL, from_tty, list);
 	      else
 		cmd_func (list, NULL, from_tty);
 	    }
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 6e379dd1e52..8b31200545d 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1784,11 +1784,9 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
 	  base_type = decode_type (cs, new_c_type, aux, objfile);
 	  index_type = objfile_type (objfile)->builtin_int;
 	  range_type
-	    = create_static_range_type ((struct type *) NULL,
-					index_type, 0, n - 1);
+	    = create_static_range_type (NULL, index_type, 0, n - 1);
 	  type =
-	    create_array_type ((struct type *) NULL, 
-			       base_type, range_type);
+	    create_array_type (NULL, base_type, range_type);
 	}
       return type;
     }
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 5c6bbef551d..29e6a67adcd 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -709,7 +709,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
       /* Set size to 0 to prevent further attempts to read the invalid
 	 section.  */
       *size = 0;
-      return (const gdb_byte *) NULL;
+      return NULL;
     }
   descriptor->data = data;
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index afd7bb5a541..0f941004384 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2178,7 +2178,7 @@ path_command (const char *dirname, int from_tty)
   current_inferior ()->environment.set (path_var_name, exec_path);
   xfree (exec_path);
   if (from_tty)
-    path_info ((char *) NULL, from_tty);
+    path_info (NULL, from_tty);
 }
 
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 94400f3f336..8db3924906c 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3321,8 +3321,7 @@ decode_line_with_last_displayed (const char *string, int flags)
        ? decode_line_1 (location.get (), flags, NULL,
 			get_last_displayed_symtab (),
 			get_last_displayed_line ())
-       : decode_line_1 (location.get (), flags, NULL,
-			(struct symtab *) NULL, 0));
+       : decode_line_1 (location.get (), flags, NULL, NULL, 0));
 
   if (*string)
     error (_("Junk at end of line specification: %s"), string);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2b54fef051a..7d0cbb71a91 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -348,7 +348,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader,
   init_header_files ();
         
   /* Make sure all the FDR information is swapped in.  */
-  if (info->fdr == (FDR *) NULL)
+  if (info->fdr == NULL)
     {
       char *fdr_src;
       char *fdr_end;
@@ -593,7 +593,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   long svalue = sh->value;
   int bitsize;
 
-  if (ext_sh == (char *) NULL)
+  if (ext_sh == NULL)
     name = debug_info->ssext + sh->iss;
   else
     name = debug_info->ss + cur_fdr->issBase + sh->iss;
@@ -1005,7 +1005,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
 	/* Create a new type or use the pending type.  */
 	pend = is_pending_symbol (cur_fdr, ext_sh);
-	if (pend == (struct mdebug_pending *) NULL)
+	if (pend == NULL)
 	  {
 	    t = new_type (NULL);
 	    add_pending (cur_fdr, ext_sh, t);
@@ -1267,9 +1267,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
       /* Parse the type or use the pending type.  */
       pend = is_pending_symbol (cur_fdr, ext_sh);
-      if (pend == (struct mdebug_pending *) NULL)
+      if (pend == NULL)
 	{
-	  t = parse_type (cur_fd, ax, sh->index, (int *) NULL, bigend, name);
+	  t = parse_type (cur_fd, ax, sh->index, NULL, bigend, name);
 	  add_pending (cur_fdr, ext_sh, t);
 	}
       else
@@ -1579,7 +1579,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       int width = AUX_GET_WIDTH (bigend, ax);
 
       /* Inhibit core dumps if TIR is corrupted.  */
-      if (bs == (int *) NULL)
+      if (bs == NULL)
 	{
 	  /* Alpha cc -migrate encodes char and unsigned char types
 	     as short and unsigned short types with a field width of 8.
@@ -1626,7 +1626,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       xref_fh = get_rfd (fd, rf);
       xref_fd = xref_fh - debug_info->fdr;
       tp = parse_type (xref_fd, debug_info->external_aux + xref_fh->iauxBase,
-		    rn->index, (int *) NULL, xref_fh->fBigendian, sym_name);
+		    rn->index, NULL, xref_fh->fBigendian, sym_name);
     }
 
   /* All these types really point to some (common) MIPS type
@@ -1644,7 +1644,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
-      if (tp == (struct type *) NULL)
+      if (tp == NULL)
 	tp = init_type (mdebugread_objfile, type_code, 0, NULL);
 
       /* DEC c89 produces cross references to qualified aggregate types,
@@ -1704,7 +1704,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
-      if (tp == (struct type *) NULL)
+      if (tp == NULL)
 	tp = init_type (mdebugread_objfile, type_code, 0, NULL);
 
       /* Make sure that TYPE_CODE(tp) has an expected type code.
@@ -1737,7 +1737,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
       /* Try to cross reference this type, it should succeed.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
-      if (tp == (struct type *) NULL)
+      if (tp == NULL)
 	{
 	  complaint (_("unable to cross ref btTypedef for %s"), sym_name);
 	  tp = basic_type (btInt, mdebugread_objfile);
@@ -1841,7 +1841,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
 
       indx = parse_type (fh - debug_info->fdr,
 			 debug_info->external_aux + fh->iauxBase,
-			 id, (int *) NULL, bigend, sym_name);
+			 id, NULL, bigend, sym_name);
 
       /* The bounds type should be an integer type, but might be anything
          else due to corrupt aux entries.  */
@@ -1860,10 +1860,9 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
       ax++;
       rf = AUX_GET_WIDTH (bigend, ax);	/* bit size of array element */
 
-      range = create_static_range_type ((struct type *) NULL, indx,
-					lower, upper);
+      range = create_static_range_type (NULL, indx, lower, upper);
 
-      t = create_array_type ((struct type *) NULL, *tpp, range);
+      t = create_array_type (NULL, *tpp, range);
 
       /* We used to fill in the supplied array element bitsize
          here if the TYPE_LENGTH of the target type was zero.
@@ -2144,7 +2143,7 @@ parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
 
       /* Note that the case of a symbol with indexNil must be handled
          anyways by parse_symbol().  */
-      parse_symbol (&es->asym, ax, (char *) NULL,
+      parse_symbol (&es->asym, ax, NULL,
 		    bigend, section_offsets, objfile);
       break;
     default:
@@ -3704,7 +3703,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
       fh = f_idx + debug_info->fdr;
       pst = fdr_to_pst[f_idx].pst;
 
-      if (pst == (struct partial_symtab *) NULL)
+      if (pst == NULL)
 	continue;
 
       /* This should catch stabs-in-ecoff.  */
@@ -3735,7 +3734,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 	    continue;
 
 	  /* Do not add to dependeny list if psymtab was empty.  */
-	  if (fdr_to_pst[rh].pst == (struct partial_symtab *) NULL)
+	  if (fdr_to_pst[rh].pst == NULL)
 	    continue;
 	  pst->dependencies[pst->number_of_dependencies++]
 	    = fdr_to_pst[rh].pst;
@@ -3909,13 +3908,13 @@ psymtab_to_symtab_1 (struct objfile *objfile,
   mdebugread_objfile = objfile;
   cur_fd = FDR_IDX (pst);
   fh = ((cur_fd == -1)
-	? (FDR *) NULL
+	? NULL
 	: debug_info->fdr + cur_fd);
   cur_fdr = fh;
 
   /* See comment in parse_partial_symbols about the @stabs sentinel.  */
   processing_gcc_compilation = 0;
-  if (fh != (FDR *) NULL && fh->csym >= 2)
+  if (fh != NULL && fh->csym >= 2)
     {
       SYMR sh;
 
@@ -4425,7 +4424,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 	      *tpp = parse_type (xref_fd,
 				 debug_info->external_aux + fh->iauxBase,
 				 sh.index,
-				 (int *) NULL,
+				 NULL,
 				 fh->fBigendian,
 				 debug_info->ss + fh->issBase + sh.iss);
 	      add_pending (fh, esh, *tpp);
@@ -4451,7 +4450,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 	  *tpp = parse_type (xref_fd,
 			     debug_info->external_aux + fh->iauxBase,
 			     sh.index,
-			     (int *) NULL,
+			     NULL,
 			     fh->fBigendian,
 			     debug_info->ss + fh->issBase + sh.iss);
 	}
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index e54dc5de45a..b25abe5a481 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -76,7 +76,7 @@ mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
      process it and define symbols accordingly.  */
 
   if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info)
-	(abfd, (asection *) NULL, &ecoff_data (abfd)->debug_info)))
+	(abfd, NULL, &ecoff_data (abfd)->debug_info)))
     error (_("Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
 
   mdebug_build_psymtabs (reader, objfile, &ecoff_backend (abfd)->debug_swap,
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 27414a9812a..a3fe6c99ca3 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2048,7 +2048,7 @@ again:
 
     case 'S':			/* Set type */
       type1 = read_type (pp, objfile);
-      type = create_set_type ((struct type *) NULL, type1);
+      type = create_set_type (NULL, type1);
       if (typenums[0] != -1)
 	*dbx_lookup_type (typenums, objfile) = type;
       break;
@@ -3585,7 +3585,7 @@ read_array_type (const char **pp, struct type *type,
     }
 
   range_type =
-    create_static_range_type ((struct type *) NULL, index_type, lower, upper);
+    create_static_range_type (NULL, index_type, lower, upper);
   type = create_array_type (type, element_type, range_type);
 
   return type;
@@ -4212,7 +4212,7 @@ handle_true_range:
     }
 
   result_type
-    = create_static_range_type ((struct type *) NULL, index_type, n2, n3);
+    = create_static_range_type (NULL, index_type, n2, n3);
   return (result_type);
 }
 
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 7c143055337..35eae4f998a 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -507,8 +507,7 @@ init_win_info (struct tui_win_info *win_info)
     {
     case SRC_WIN:
     case DISASSEM_WIN:
-      win_info->detail.source_info.execution_info
-	= (struct tui_gen_win_info *) NULL;
+      win_info->detail.source_info.execution_info = NULL;
       win_info->detail.source_info.has_locator = FALSE;
       win_info->detail.source_info.horizontal_offset = 0;
       win_info->detail.source_info.gdbarch = NULL;
@@ -620,7 +619,7 @@ tui_del_window (struct tui_win_info *win_info)
     case SRC_WIN:
     case DISASSEM_WIN:
       generic_win = tui_locator_win_info_ptr ();
-      if (generic_win != (struct tui_gen_win_info *) NULL)
+      if (generic_win != NULL)
 	{
 	  tui_delete_win (generic_win->handle);
 	  generic_win->handle = NULL;
@@ -632,7 +631,7 @@ tui_del_window (struct tui_win_info *win_info)
           win_info->detail.source_info.fullname = NULL;
         }
       generic_win = win_info->detail.source_info.execution_info;
-      if (generic_win != (struct tui_gen_win_info *) NULL)
+      if (generic_win != NULL)
 	{
 	  tui_delete_win (generic_win->handle);
 	  generic_win->handle = NULL;
@@ -651,7 +650,7 @@ tui_del_window (struct tui_win_info *win_info)
     default:
       break;
     }
-  if (win_info->generic.handle != (WINDOW *) NULL)
+  if (win_info->generic.handle != NULL)
     {
       tui_delete_win (win_info->generic.handle);
       win_info->generic.handle = NULL;
@@ -675,7 +674,7 @@ tui_free_window (struct tui_win_info *win_info)
           win_info->detail.source_info.fullname = NULL;
         }
       generic_win = win_info->detail.source_info.execution_info;
-      if (generic_win != (struct tui_gen_win_info *) NULL)
+      if (generic_win != NULL)
 	{
 	  tui_delete_win (generic_win->handle);
 	  generic_win->handle = NULL;
@@ -704,7 +703,7 @@ tui_free_window (struct tui_win_info *win_info)
     default:
       break;
     }
-  if (win_info->generic.handle != (WINDOW *) NULL)
+  if (win_info->generic.handle != NULL)
     {
       tui_delete_win (win_info->generic.handle);
       win_info->generic.handle = NULL;
@@ -762,7 +761,7 @@ tui_del_data_windows (tui_win_content content,
       struct tui_gen_win_info *generic_win
 	= &content[i]->which_element.data_window;
 
-      if (generic_win != (struct tui_gen_win_info *) NULL)
+      if (generic_win != NULL)
 	{
 	  tui_delete_win (generic_win->handle);
 	  generic_win->handle = NULL;
@@ -786,7 +785,7 @@ tui_free_data_content (tui_win_content content,
       struct tui_gen_win_info *generic_win
 	= &content[i]->which_element.data_window;
 
-      if (generic_win != (struct tui_gen_win_info *) NULL)
+      if (generic_win != NULL)
 	{
 	  tui_delete_win (generic_win->handle);
 	  generic_win->handle = NULL;
@@ -840,7 +839,7 @@ free_content_elements (tui_win_content content,
 	      struct tui_win_element *element;
 
 	      element = content[i];
-	      if (element != (struct tui_win_element *) NULL)
+	      if (element != NULL)
 		{
 		  switch (type)
 		    {
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index ad47c8205f3..31c1c769381 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -878,7 +878,7 @@ tui_initialize_io (void)
   if (tui_rl_outstream == 0)
     error (_("Cannot redirect readline output"));
 
-  setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0);
+  setvbuf (tui_rl_outstream, NULL, _IOLBF, 0);
 
 #ifdef O_NONBLOCK
   (void) fcntl (tui_readline_pipe[0], F_SETFL, O_NONBLOCK);
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index da50ced607d..bcae819e518 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -300,7 +300,7 @@ tui_default_win_height (enum tui_win_type type,
 {
   int h;
 
-  if (tui_win_list[type] != (struct tui_win_info *) NULL)
+  if (tui_win_list[type] != NULL)
     h = tui_win_list[type]->generic.height;
   else
     {
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index e6aeedd9231..dcfc433407c 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -358,7 +358,7 @@ tui_display_registers_from (int start_element_no)
 	      data_item_win = &display_info->regs_content[i]
                 ->which_element.data_window;
 	      data_element_ptr = &data_item_win->content[0]->which_element.data;
-              if (data_item_win->handle != (WINDOW*) NULL
+              if (data_item_win->handle != NULL
                   && (data_item_win->height != 1
                       || data_item_win->width != item_win_width
                       || data_item_win->origin.x != (item_win_width * j) + 1
@@ -368,7 +368,7 @@ tui_display_registers_from (int start_element_no)
                   data_item_win->handle = 0;
                 }
                   
-	      if (data_item_win->handle == (WINDOW *) NULL)
+	      if (data_item_win->handle == NULL)
 		{
 		  data_item_win->height = 1;
 		  data_item_win->width = item_win_width;
@@ -520,7 +520,7 @@ static void
 tui_display_register (struct tui_data_element *data,
                       struct tui_gen_win_info *win_info)
 {
-  if (win_info->handle != (WINDOW *) NULL)
+  if (win_info->handle != NULL)
     {
       int i;
 
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 1fa0e986e03..5066c7d7b4f 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -129,7 +129,7 @@ tui_set_source_content (struct symtab *s,
 {
   enum tui_status ret = TUI_FAILURE;
 
-  if (s != (struct symtab *) NULL)
+  if (s != NULL)
     {
       int line_width, nlines;
 
@@ -319,7 +319,7 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
       tui_win_content content = TUI_SRC_WIN->generic.content;
       struct symtab_and_line cursal = get_current_source_symtab_and_line ();
 
-      if (cursal.symtab == (struct symtab *) NULL)
+      if (cursal.symtab == NULL)
 	s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
       else
 	s = cursal.symtab;
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 79f1f6fbbe3..b7e7ae81dff 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -250,7 +250,7 @@ tui_show_locator_content (void)
 
   locator = tui_locator_win_info_ptr ();
 
-  if (locator != NULL && locator->handle != (WINDOW *) NULL)
+  if (locator != NULL && locator->handle != NULL)
     {
       struct tui_win_element *element;
 
@@ -414,8 +414,7 @@ tui_show_frame_info (struct frame_info *fi)
 	  else
 	    {
 	      if (find_pc_partial_function (get_frame_pc (fi),
-					    (const char **) NULL,
-					    &low, NULL) == 0)
+					    NULL, &low, NULL) == 0)
 		{
 		  /* There is no symbol available for current PC.  There is no
 		     safe way how to "disassemble backwards".  */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 575620f4c89..a1329e54a81 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -877,7 +877,7 @@ tui_scroll_forward_command (const char *arg, int from_tty)
   /* Make sure the curses mode is enabled.  */
   tui_enable ();
   if (arg == NULL)
-    parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+    parse_scrolling_args (arg, &win_to_scroll, NULL);
   else
     parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
   tui_scroll (FORWARD_SCROLL, win_to_scroll, num_to_scroll);
@@ -893,7 +893,7 @@ tui_scroll_backward_command (const char *arg, int from_tty)
   /* Make sure the curses mode is enabled.  */
   tui_enable ();
   if (arg == NULL)
-    parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+    parse_scrolling_args (arg, &win_to_scroll, NULL);
   else
     parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
   tui_scroll (BACKWARD_SCROLL, win_to_scroll, num_to_scroll);
@@ -946,8 +946,7 @@ tui_set_focus (const char *arg, int from_tty)
       else
 	win_info = tui_partial_win_by_name (buf_ptr);
 
-      if (win_info == (struct tui_win_info *) NULL
-	  || !win_info->generic.is_visible)
+      if (win_info == NULL || !win_info->generic.is_visible)
 	warning (_("Invalid window specified. \n\
 The window name specified must be valid and visible.\n"));
       else
@@ -1116,8 +1115,7 @@ tui_set_win_height (const char *arg, int from_tty)
 	    wname[i] = tolower (wname[i]);
 	  win_info = tui_partial_win_by_name (wname);
 
-	  if (win_info == (struct tui_win_info *) NULL
-	      || !win_info->generic.is_visible)
+	  if (win_info == NULL || !win_info->generic.is_visible)
 	    warning (_("Invalid window specified. \n\
 The window name specified must be valid and visible.\n"));
 	  else
@@ -1634,7 +1632,7 @@ parse_scrolling_args (const char *arg,
 	  
 	  *win_to_scroll = tui_partial_win_by_name (wname);
 
-	  if (*win_to_scroll == (struct tui_win_info *) NULL
+	  if (*win_to_scroll == NULL
 	      || !(*win_to_scroll)->generic.is_visible)
 	    error (_("Invalid window specified. \n\
 The window name specified must be valid and visible.\n"));
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 1bab39f9975..6f150c96620 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -55,7 +55,7 @@ tui_first_data_item_displayed (void)
 
       data_item_win
 	= &TUI_DATA_WIN->generic.content[i]->which_element.data_window;
-      if (data_item_win->handle != (WINDOW *) NULL 
+      if (data_item_win->handle != NULL 
 	  && data_item_win->is_visible)
 	element_no = i;
     }
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index b1ed0f4378d..b474aa0f1d9 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -45,7 +45,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
 
 	  data_item_win_ptr = &win_info->content[i]->which_element.data_window;
 	  if (data_item_win_ptr != NULL
-	      && data_item_win_ptr->handle != (WINDOW *) NULL)
+	      && data_item_win_ptr->handle != NULL)
 	    wrefresh (data_item_win_ptr->handle);
 	}
     }
@@ -55,7 +55,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
     }
   else
     {
-      if (win_info->handle != (WINDOW *) NULL)
+      if (win_info->handle != NULL)
 	wrefresh (win_info->handle);
     }
 
@@ -67,7 +67,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
 void
 tui_delete_win (WINDOW *window)
 {
-  if (window != (WINDOW *) NULL)
+  if (window != NULL)
     delwin (window);
 
   return;
@@ -110,7 +110,7 @@ void
 tui_unhighlight_win (struct tui_win_info *win_info)
 {
   if (win_info != NULL 
-      && win_info->generic.handle != (WINDOW *) NULL)
+      && win_info->generic.handle != NULL)
     {
       box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
       wrefresh (win_info->generic.handle);
@@ -124,7 +124,7 @@ tui_highlight_win (struct tui_win_info *win_info)
 {
   if (win_info != NULL
       && win_info->can_highlight
-      && win_info->generic.handle != (WINDOW *) NULL)
+      && win_info->generic.handle != NULL)
     {
       box_win ((struct tui_gen_win_info *) win_info, HILITE);
       wrefresh (win_info->generic.handle);
@@ -157,7 +157,7 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it)
 		   win_info->origin.y,
 		   win_info->origin.x);
   win_info->handle = handle;
-  if (handle != (WINDOW *) NULL)
+  if (handle != NULL)
     {
       if (box_it == BOX_WINDOW)
 	box_win (win_info, NO_HILITE);
@@ -189,7 +189,7 @@ make_visible (struct tui_gen_win_info *win_info, int visible)
     }
   else if (!visible
 	   && win_info->is_visible
-	   && win_info->handle != (WINDOW *) NULL)
+	   && win_info->handle != NULL)
     {
       win_info->is_visible = FALSE;
       tui_delete_win (win_info->handle);
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index e31a0164cf2..eab422d6cf1 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -235,7 +235,7 @@ tui_erase_source_content (struct tui_win_info *win_info,
   int x_pos;
   int half_width = (win_info->generic.width - 2) / 2;
 
-  if (win_info->generic.handle != (WINDOW *) NULL)
+  if (win_info->generic.handle != NULL)
     {
       werase (win_info->generic.handle);
       tui_check_and_display_highlight_if_needed (win_info);
@@ -453,7 +453,7 @@ tui_update_breakpoint_info (struct tui_win_info *win,
          those that we already hit.  */
       mode = 0;
       for (bp = breakpoint_chain;
-           bp != (struct breakpoint *) NULL;
+           bp != NULL;
            bp = bp->next)
         {
 	  struct bp_location *loc;
@@ -504,8 +504,7 @@ tui_set_exec_info_content (struct tui_win_info *win_info)
 {
   enum tui_status ret = TUI_SUCCESS;
 
-  if (win_info->detail.source_info.execution_info
-      != (struct tui_gen_win_info *) NULL)
+  if (win_info->detail.source_info.execution_info != NULL)
     {
       struct tui_gen_win_info *exec_info_ptr
 	= win_info->detail.source_info.execution_info;
diff --git a/gdb/utils.c b/gdb/utils.c
index f55661287eb..c7922cf7f56 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2771,7 +2771,7 @@ subset_compare (const char *string_to_compare, const char *template_string)
 {
   int match;
 
-  if (template_string != (char *) NULL && string_to_compare != (char *) NULL
+  if (template_string != NULL && string_to_compare != NULL
       && strlen (string_to_compare) <= strlen (template_string))
     match =
       (startswith (template_string, string_to_compare));
diff --git a/gdb/valops.c b/gdb/valops.c
index cbf2eccde3e..948ad89fe92 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -402,12 +402,12 @@ value_cast (struct type *type, struct value *arg2)
 		       "divide object size in cast"));
 	  /* FIXME-type-allocation: need a way to free this type when
 	     we are done with it.  */
-	  range_type = create_static_range_type ((struct type *) NULL,
+	  range_type = create_static_range_type (NULL,
 						 TYPE_TARGET_TYPE (range_type),
 						 low_bound,
 						 new_length + low_bound - 1);
 	  deprecated_set_value_type (arg2, 
-				     create_array_type ((struct type *) NULL,
+				     create_array_type (NULL,
 							element_type, 
 							range_type));
 	  return arg2;
@@ -3816,7 +3816,7 @@ value_slice (struct value *array, int lowbound, int length)
 
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
-  slice_range_type = create_static_range_type ((struct type *) NULL,
+  slice_range_type = create_static_range_type (NULL,
 					       TYPE_TARGET_TYPE (range_type),
 					       lowbound,
 					       lowbound + length - 1);
@@ -3826,7 +3826,7 @@ value_slice (struct value *array, int lowbound, int length)
     LONGEST offset
       = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
 
-    slice_type = create_array_type ((struct type *) NULL,
+    slice_type = create_array_type (NULL,
 				    element_type,
 				    slice_range_type);
     TYPE_CODE (slice_type) = TYPE_CODE (array_type);
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 215645d6e11..f4892a8054f 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1045,7 +1045,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
   pst_symtab_language = deduce_language_from_filename (filestring);
 
   start_stabs ();
-  start_symtab (objfile, filestring, (char *) NULL, file_start_addr,
+  start_symtab (objfile, filestring, NULL, file_start_addr,
 		pst_symtab_language);
   record_debugformat (debugfmt);
   symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
@@ -1139,8 +1139,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	    }
 
 	  start_stabs ();
-	  start_symtab (objfile, "_globals_", (char *) NULL,
-			(CORE_ADDR) 0, pst_symtab_language);
+	  start_symtab (objfile, "_globals_", NULL,
+			0, pst_symtab_language);
 	  record_debugformat (debugfmt);
 	  cur_src_end_addr = first_object_file_end;
 	  /* Done with all files, everything from here on is globals.  */
@@ -1230,7 +1230,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 			  /* Give all csects for this source file the same
 			     name.  */
 			  start_symtab (objfile, filestring, NULL,
-					(CORE_ADDR) 0, pst_symtab_language);
+					0, pst_symtab_language);
 			  record_debugformat (debugfmt);
 			}
 
@@ -1350,8 +1350,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	    filestring = cs->c_name;
 
 	  start_stabs ();
-	  start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0,
-			pst_symtab_language);
+	  start_symtab (objfile, filestring, NULL, 0, pst_symtab_language);
 	  record_debugformat (debugfmt);
 	  last_csect_name = 0;
 
-- 
2.17.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]