Patchwork [RFA,1/2] Remove "do_nothing"

login
register
mail settings
Submitter Tom Tromey
Date Oct. 9, 2017, 2:42 a.m.
Message ID <20171009024300.8346-2-tom@tromey.com>
Download mbox | patch
Permalink /patch/23400/
State New
Headers show

Comments

Tom Tromey - Oct. 9, 2017, 2:42 a.m.
The do_nothing function in mi-main.c is used as a splay tree
key-deleting function; but NULL serves the same purpose and is used
elsewhere in gdb.  This patch removes the unneeded function.

gdb/ChangeLog
2017-10-08  Tom Tromey  <tom@tromey.com>

	* mi/mi-main.c (do_nothing): Remove.
	(list_available_thread_groups): Update.
---
 gdb/ChangeLog    | 5 +++++
 gdb/mi/mi-main.c | 7 +------
 2 files changed, 6 insertions(+), 6 deletions(-)
Simon Marchi - Oct. 9, 2017, 2:03 p.m.
On 2017-10-08 10:42 PM, Tom Tromey wrote:
> The do_nothing function in mi-main.c is used as a splay tree
> key-deleting function; but NULL serves the same purpose and is used
> elsewhere in gdb.  This patch removes the unneeded function.
> 
> gdb/ChangeLog
> 2017-10-08  Tom Tromey  <tom@tromey.com>
> 
> 	* mi/mi-main.c (do_nothing): Remove.
> 	(list_available_thread_groups): Update.
> ---
>  gdb/ChangeLog    | 5 +++++
>  gdb/mi/mi-main.c | 7 +------
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
> index 289445f832..98fff4f1b5 100644
> --- a/gdb/mi/mi-main.c
> +++ b/gdb/mi/mi-main.c
> @@ -702,11 +702,6 @@ output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
>  }
>  
>  static void
> -do_nothing (splay_tree_key k)
> -{
> -}
> -
> -static void
>  free_vector_of_osdata_items (splay_tree_value xvalue)
>  {
>    VEC (osdata_item_s) *value = (VEC (osdata_item_s) *) xvalue;
> @@ -756,7 +751,7 @@ list_available_thread_groups (const std::set<int> &ids, int recurse)
>  
>        make_cleanup_osdata_free (threads);
>        tree = splay_tree_new (splay_tree_int_comparator,
> -			     do_nothing,
> +			     NULL,
>  			     free_vector_of_osdata_items);
>        make_cleanup (free_splay_tree, tree);
>  
> 

LGTM.

Patch

diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 289445f832..98fff4f1b5 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -702,11 +702,6 @@  output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
 }
 
 static void
-do_nothing (splay_tree_key k)
-{
-}
-
-static void
 free_vector_of_osdata_items (splay_tree_value xvalue)
 {
   VEC (osdata_item_s) *value = (VEC (osdata_item_s) *) xvalue;
@@ -756,7 +751,7 @@  list_available_thread_groups (const std::set<int> &ids, int recurse)
 
       make_cleanup_osdata_free (threads);
       tree = splay_tree_new (splay_tree_int_comparator,
-			     do_nothing,
+			     NULL,
 			     free_vector_of_osdata_items);
       make_cleanup (free_splay_tree, tree);