[RFA,v2,24/24] Remove make_cleanup_freeargv and gdb_buildargv

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

Commit Message

Tom Tromey July 25, 2017, 5:21 p.m. UTC
  After the previous patches in this series, make_cleanup_freeargv and
gdb_buildargv are now unused and can be removed.

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

	* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
	Remove.
	* utils.h (make_cleanup_freeargv, gdb_buildargv): Remove.
---
 gdb/ChangeLog |  6 ++++++
 gdb/utils.c   | 27 ---------------------------
 gdb/utils.h   |  4 ----
 3 files changed, 6 insertions(+), 31 deletions(-)
  

Comments

Simon Marchi July 31, 2017, 8:26 p.m. UTC | #1
On 2017-07-25 19:21, Tom Tromey wrote:
> After the previous patches in this series, make_cleanup_freeargv and
> gdb_buildargv are now unused and can be removed.
> 
> ChangeLog
> 2017-07-25  Tom Tromey  <tom@tromey.com>
> 
> 	* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
> 	Remove.
> 	* utils.h (make_cleanup_freeargv, gdb_buildargv): Remove.
> ---
>  gdb/ChangeLog |  6 ++++++
>  gdb/utils.c   | 27 ---------------------------
>  gdb/utils.h   |  4 ----
>  3 files changed, 6 insertions(+), 31 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 4168f39..9ac62bc 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,11 @@
>  2017-07-25  Tom Tromey  <tom@tromey.com>
> 
> +	* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
> +	Remove.
> +	* utils.h (make_cleanup_freeargv, gdb_buildargv): Remove.
> +
> +2017-07-25  Tom Tromey  <tom@tromey.com>
> +
>  	* python/py-param.c (compute_enum_values): Use gdb_argv.
> 
>  2017-07-25  Tom Tromey  <tom@tromey.com>
> diff --git a/gdb/utils.c b/gdb/utils.c
> index 8a7a60f..96ae709 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -136,18 +136,6 @@ show_pagination_enabled (struct ui_file *file,
> int from_tty,
>     because while they use the "cleanup API" they are not part of the
>     "cleanup API".  */
> 
> -static void
> -do_freeargv (void *arg)
> -{
> -  freeargv ((char **) arg);
> -}
> -
> -struct cleanup *
> -make_cleanup_freeargv (char **arg)
> -{
> -  return make_cleanup (do_freeargv, arg);
> -}
> -
>  /* Helper function for make_cleanup_ui_out_redirect_pop.  */
> 
>  static void
> @@ -2877,21 +2865,6 @@ gdb_argv::reset (const char *s)
>    m_argv = argv;
>  }
> 
> -/* Call libiberty's buildargv, and return the result.
> -   If buildargv fails due to out-of-memory, call nomem.
> -   Therefore, the returned value is guaranteed to be non-NULL,
> -   unless the parameter itself is NULL.  */
> -
> -char **
> -gdb_buildargv (const char *s)
> -{
> -  char **argv = buildargv (s);
> -
> -  if (s != NULL && argv == NULL)
> -    malloc_failure (0);
> -  return argv;
> -}
> -
>  int
>  compare_positive_ints (const void *ap, const void *bp)
>  {
> diff --git a/gdb/utils.h b/gdb/utils.h
> index 88cab4b..c922a22 100644
> --- a/gdb/utils.h
> +++ b/gdb/utils.h
> @@ -85,8 +85,6 @@ extern int parse_pid_to_attach (const char *args);
> 
>  extern int parse_escape (struct gdbarch *, const char **);
> 
> -char **gdb_buildargv (const char *);
> -
>  /* A wrapper for an array of char* that was allocated in the way that
>     'buildargv' does, and should be freed with 'freeargv'.  */
> 
> @@ -207,8 +205,6 @@ private:
>  
>  /* Cleanup utilities.  */
> 
> -extern struct cleanup *make_cleanup_freeargv (char **);
> -
>  struct ui_out;
>  extern struct cleanup *
>    make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);


LGTM, thanks a lot for your work!

Simon
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4168f39..9ac62bc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2017-07-25  Tom Tromey  <tom@tromey.com>
 
+	* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
+	Remove.
+	* utils.h (make_cleanup_freeargv, gdb_buildargv): Remove.
+
+2017-07-25  Tom Tromey  <tom@tromey.com>
+
 	* python/py-param.c (compute_enum_values): Use gdb_argv.
 
 2017-07-25  Tom Tromey  <tom@tromey.com>
diff --git a/gdb/utils.c b/gdb/utils.c
index 8a7a60f..96ae709 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -136,18 +136,6 @@  show_pagination_enabled (struct ui_file *file, int from_tty,
    because while they use the "cleanup API" they are not part of the
    "cleanup API".  */
 
-static void
-do_freeargv (void *arg)
-{
-  freeargv ((char **) arg);
-}
-
-struct cleanup *
-make_cleanup_freeargv (char **arg)
-{
-  return make_cleanup (do_freeargv, arg);
-}
-
 /* Helper function for make_cleanup_ui_out_redirect_pop.  */
 
 static void
@@ -2877,21 +2865,6 @@  gdb_argv::reset (const char *s)
   m_argv = argv;
 }
 
-/* Call libiberty's buildargv, and return the result.
-   If buildargv fails due to out-of-memory, call nomem.
-   Therefore, the returned value is guaranteed to be non-NULL,
-   unless the parameter itself is NULL.  */
- 
-char **
-gdb_buildargv (const char *s)
-{
-  char **argv = buildargv (s);
-
-  if (s != NULL && argv == NULL)
-    malloc_failure (0);
-  return argv;
-}
-
 int
 compare_positive_ints (const void *ap, const void *bp)
 {
diff --git a/gdb/utils.h b/gdb/utils.h
index 88cab4b..c922a22 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -85,8 +85,6 @@  extern int parse_pid_to_attach (const char *args);
 
 extern int parse_escape (struct gdbarch *, const char **);
 
-char **gdb_buildargv (const char *);
-
 /* A wrapper for an array of char* that was allocated in the way that
    'buildargv' does, and should be freed with 'freeargv'.  */
 
@@ -207,8 +205,6 @@  private:
 
 /* Cleanup utilities.  */
 
-extern struct cleanup *make_cleanup_freeargv (char **);
-
 struct ui_out;
 extern struct cleanup *
   make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);