[RFA,v2,07/24] Remove make_cleanup_fclose

Message ID 20170725172107.9799-8-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey July 25, 2017, 5:20 p.m. UTC
  After the preceding patches, make_cleanup_fclose is no longer used, so
remove it.

ChangeLog
2017-07-25  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_fclose): Remove.
	* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.
---
 gdb/ChangeLog |  5 +++++
 gdb/utils.c   | 18 ------------------
 gdb/utils.h   |  2 --
 3 files changed, 5 insertions(+), 20 deletions(-)
  

Comments

Simon Marchi July 30, 2017, 7:05 p.m. UTC | #1
On 2017-07-25 19:20, Tom Tromey wrote:
> After the preceding patches, make_cleanup_fclose is no longer used, so
> remove it.
> 
> ChangeLog
> 2017-07-25  Tom Tromey  <tom@tromey.com>
> 
> 	* utils.h (make_cleanup_fclose): Remove.
> 	* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.
> ---
>  gdb/ChangeLog |  5 +++++
>  gdb/utils.c   | 18 ------------------
>  gdb/utils.h   |  2 --
>  3 files changed, 5 insertions(+), 20 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index c1730dd..9d46731 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,10 @@
>  2017-07-25  Tom Tromey  <tom@tromey.com>
> 
> +	* utils.h (make_cleanup_fclose): Remove.
> +	* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.
> +
> +2017-07-25  Tom Tromey  <tom@tromey.com>
> +
>  	* top.c (open_terminal_stream): Return gdb_file_up.
>  	(new_ui_command): Update.
> 
> diff --git a/gdb/utils.c b/gdb/utils.c
> index 43e1827..c6b5423 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -148,24 +148,6 @@ make_cleanup_freeargv (char **arg)
>    return make_cleanup (do_freeargv, arg);
>  }
> 
> -/* Helper function which does the work for make_cleanup_fclose.  */
> -
> -static void
> -do_fclose_cleanup (void *arg)
> -{
> -  FILE *file = (FILE *) arg;
> -
> -  fclose (file);
> -}
> -
> -/* Return a new cleanup that closes FILE.  */
> -
> -struct cleanup *
> -make_cleanup_fclose (FILE *file)
> -{
> -  return make_cleanup (do_fclose_cleanup, file);
> -}
> -
>  /* Helper function for make_cleanup_ui_out_redirect_pop.  */
> 
>  static void
> diff --git a/gdb/utils.h b/gdb/utils.h
> index 48330a1..a6709c0 100644
> --- a/gdb/utils.h
> +++ b/gdb/utils.h
> @@ -101,8 +101,6 @@ extern struct cleanup 
> *(make_cleanup_free_section_addr_info
> 
>  /* For make_cleanup_close see common/filestuff.h.  */
> 
> -extern struct cleanup *make_cleanup_fclose (FILE *file);
> -
>  extern struct cleanup *make_cleanup_restore_integer (int *variable);
>  extern struct cleanup *make_cleanup_restore_uinteger (unsigned int 
> *variable);

Yay, thanks!  LGTM.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c1730dd..9d46731 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2017-07-25  Tom Tromey  <tom@tromey.com>
 
+	* utils.h (make_cleanup_fclose): Remove.
+	* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.
+
+2017-07-25  Tom Tromey  <tom@tromey.com>
+
 	* top.c (open_terminal_stream): Return gdb_file_up.
 	(new_ui_command): Update.
 
diff --git a/gdb/utils.c b/gdb/utils.c
index 43e1827..c6b5423 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -148,24 +148,6 @@  make_cleanup_freeargv (char **arg)
   return make_cleanup (do_freeargv, arg);
 }
 
-/* Helper function which does the work for make_cleanup_fclose.  */
-
-static void
-do_fclose_cleanup (void *arg)
-{
-  FILE *file = (FILE *) arg;
-
-  fclose (file);
-}
-
-/* Return a new cleanup that closes FILE.  */
-
-struct cleanup *
-make_cleanup_fclose (FILE *file)
-{
-  return make_cleanup (do_fclose_cleanup, file);
-}
-
 /* Helper function for make_cleanup_ui_out_redirect_pop.  */
 
 static void
diff --git a/gdb/utils.h b/gdb/utils.h
index 48330a1..a6709c0 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -101,8 +101,6 @@  extern struct cleanup *(make_cleanup_free_section_addr_info
 
 /* For make_cleanup_close see common/filestuff.h.  */
 
-extern struct cleanup *make_cleanup_fclose (FILE *file);
-
 extern struct cleanup *make_cleanup_restore_integer (int *variable);
 extern struct cleanup *make_cleanup_restore_uinteger (unsigned int *variable);