[v3,6/6] gdbsupport: Drop now unused function 'stringify_argv'

Message ID 20200512154211.1311364-6-m.weghorn@posteo.de
State Superseded
Headers show
Series
  • [v3,1/6] gdb: Move construct_inferior_arguments to gdbsupport
Related show

Commit Message

Kevin Buettner via Gdb-patches May 12, 2020, 3:42 p.m.
The function did not properly escape special characters
and all uses have been replaced in previous commits, so
drop the now unused function.

gdbsupport/ChangeLog:

2020-05-12  Michael Weghorn  <m.weghorn@posteo.de>

        * common-utils.cc, common-utils.h (stringify_argv): Drop
        now unused function stringify_argv
---
 gdbsupport/common-utils.cc | 23 -----------------------
 gdbsupport/common-utils.h  |  4 ----
 2 files changed, 27 deletions(-)

-- 
2.26.2

Comments

Simon Marchi May 13, 2020, 12:52 a.m. | #1
On 2020-05-12 11:42 a.m., Michael Weghorn via Gdb-patches wrote:
> The function did not properly escape special characters

> and all uses have been replaced in previous commits, so

> drop the now unused function.

> 

> gdbsupport/ChangeLog:

> 

> 2020-05-12  Michael Weghorn  <m.weghorn@posteo.de>

> 

>         * common-utils.cc, common-utils.h (stringify_argv): Drop

>         now unused function stringify_argv

> ---

>  gdbsupport/common-utils.cc | 23 -----------------------

>  gdbsupport/common-utils.h  |  4 ----

>  2 files changed, 27 deletions(-)

> 

> diff --git a/gdbsupport/common-utils.cc b/gdbsupport/common-utils.cc

> index ed05d619c7..b5e4d2928e 100644

> --- a/gdbsupport/common-utils.cc

> +++ b/gdbsupport/common-utils.cc

> @@ -375,29 +375,6 @@ free_vector_argv (std::vector<char *> &v)

>  

>  /* See gdbsupport/common-utils.h.  */

>  

> -std::string

> -stringify_argv (const std::vector<char *> &args)

> -{

> -  std::string ret;

> -

> -  if (!args.empty () && args[0] != NULL)

> -    {

> -      for (auto s : args)

> -	if (s != NULL)

> -	  {

> -	    ret += s;

> -	    ret += ' ';

> -	  }

> -

> -      /* Erase the last whitespace.  */

> -      ret.erase (ret.end () - 1);

> -    }

> -

> -  return ret;

> -}

> -

> -/* See gdbsupport/common-utils.h.  */

> -

>  ULONGEST

>  align_up (ULONGEST v, int n)

>  {

> diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h

> index ba03427c6f..30ee412365 100644

> --- a/gdbsupport/common-utils.h

> +++ b/gdbsupport/common-utils.h

> @@ -154,10 +154,6 @@ extern const char *skip_to_space (const char *inp);

>     freeing all the elements.  */

>  extern void free_vector_argv (std::vector<char *> &v);

>  

> -/* Given a vector of arguments ARGV, return a string equivalent to

> -   joining all the arguments with a whitespace separating them.  */

> -extern std::string stringify_argv (const std::vector<char *> &argv);

> -

>  /* Return true if VALUE is in [LOW, HIGH].  */

>  

>  template <typename T>

> -- 

> 2.26.2

> 


This LGTM too.

Simon

Patch

diff --git a/gdbsupport/common-utils.cc b/gdbsupport/common-utils.cc
index ed05d619c7..b5e4d2928e 100644
--- a/gdbsupport/common-utils.cc
+++ b/gdbsupport/common-utils.cc
@@ -375,29 +375,6 @@  free_vector_argv (std::vector<char *> &v)
 
 /* See gdbsupport/common-utils.h.  */
 
-std::string
-stringify_argv (const std::vector<char *> &args)
-{
-  std::string ret;
-
-  if (!args.empty () && args[0] != NULL)
-    {
-      for (auto s : args)
-	if (s != NULL)
-	  {
-	    ret += s;
-	    ret += ' ';
-	  }
-
-      /* Erase the last whitespace.  */
-      ret.erase (ret.end () - 1);
-    }
-
-  return ret;
-}
-
-/* See gdbsupport/common-utils.h.  */
-
 ULONGEST
 align_up (ULONGEST v, int n)
 {
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index ba03427c6f..30ee412365 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -154,10 +154,6 @@  extern const char *skip_to_space (const char *inp);
    freeing all the elements.  */
 extern void free_vector_argv (std::vector<char *> &v);
 
-/* Given a vector of arguments ARGV, return a string equivalent to
-   joining all the arguments with a whitespace separating them.  */
-extern std::string stringify_argv (const std::vector<char *> &argv);
-
 /* Return true if VALUE is in [LOW, HIGH].  */
 
 template <typename T>