public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change mi_parse_argv to a method
@ 2023-05-23 19:47 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-05-23 19:47 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7df1df795f7c738f33c0e40d99a95cf9876d6f59

commit 7df1df795f7c738f33c0e40d99a95cf9876d6f59
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Mar 20 10:48:50 2023 -0600

    Change mi_parse_argv to a method
    
    This changes mi_parse_argv to be a method of mi_parse.  This is just a
    minor cleanup.

Diff:
---
 gdb/mi/mi-cmds.c      | 2 +-
 gdb/mi/mi-parse.c     | 8 ++++----
 gdb/mi/mi-parse.h     | 7 +++----
 gdb/python/py-micmd.c | 2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index ca8c633e218..f8cae4131d8 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -49,7 +49,7 @@ struct mi_command_mi : public mi_command
      with arguments contained within PARSE.  */
   void invoke (struct mi_parse *parse) const override
   {
-    mi_parse_argv (parse->args (), parse);
+    parse->parse_argv ();
 
     if (parse->argv == nullptr)
       error (_("Problem parsing arguments: %s %s"), parse->command,
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index bf3b534e590..f077eb36a7c 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -107,9 +107,9 @@ mi_parse_escape (const char **string_ptr)
 }
 
 void
-mi_parse_argv (const char *args, struct mi_parse *parse)
+mi_parse::parse_argv ()
 {
-  const char *chp = args;
+  const char *chp = m_args.get ();
   int argc = 0;
   char **argv = XNEWVEC (char *, argc + 1);
 
@@ -124,8 +124,8 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
       switch (*chp)
 	{
 	case '\0':
-	  parse->argv = argv;
-	  parse->argc = argc;
+	  this->argv = argv;
+	  this->argc = argc;
 	  return;
 	case '"':
 	  {
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index d4ac3f002e4..edb61547354 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -46,6 +46,9 @@ struct mi_parse
 
     DISABLE_COPY_AND_ASSIGN (mi_parse);
 
+    /* Split the arguments into argc/argv and store the result.  */
+    void parse_argv ();
+
     /* Return the full argument string, as used by commands which are
        implemented as CLI commands.  */
     const char *args () const
@@ -90,8 +93,4 @@ extern std::unique_ptr<struct mi_parse> mi_parse (const char *cmd,
 
 enum print_values mi_parse_print_values (const char *name);
 
-/* Split ARGS into argc/argv and store the result in PARSE.  */
-
-extern void mi_parse_argv (const char *args, struct mi_parse *parse);
-
 #endif /* MI_MI_PARSE_H */
diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c
index 88d52db2202..7027210d0d8 100644
--- a/gdb/python/py-micmd.c
+++ b/gdb/python/py-micmd.c
@@ -355,7 +355,7 @@ mi_command_py::invoke (struct mi_parse *parse) const
 
   pymicmd_debug_printf ("this = %p, name = %s", this, name ());
 
-  mi_parse_argv (parse->args (), parse);
+  parse->parse_argv ();
 
   if (parse->argv == nullptr)
     error (_("Problem parsing arguments: %s %s"), parse->command,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-23 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 19:47 [binutils-gdb] Change mi_parse_argv to a method Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).