public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use member initializers in mi_parse
@ 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=c55db01a31c84f2223e18cd274203d1c3ccc7844

commit c55db01a31c84f2223e18cd274203d1c3ccc7844
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Mar 20 10:37:23 2023 -0600

    Use member initializers in mi_parse
    
    This changes mi_parse to use member initializers rather than a
    constructor.  This is easier to follow.

Diff:
---
 gdb/mi/mi-parse.c | 17 -----------------
 gdb/mi/mi-parse.h | 28 ++++++++++++++--------------
 2 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 737ec57eddd..bda554a568e 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -208,23 +208,6 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
     }
 }
 
-mi_parse::mi_parse ()
-  : op (MI_COMMAND),
-    command (NULL),
-    token (NULL),
-    cmd (NULL),
-    cmd_start (NULL),
-    args (NULL),
-    argv (NULL),
-    argc (0),
-    all (0),
-    thread_group (-1),
-    thread (-1),
-    frame (-1),
-    language (language_unknown)
-{
-}
-
 mi_parse::~mi_parse ()
 {
   xfree (command);
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index e34796988a4..75bb36b1c77 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -41,27 +41,27 @@ enum mi_command_type
 
 struct mi_parse
   {
-    mi_parse ();
+    mi_parse () = default;
     ~mi_parse ();
 
     DISABLE_COPY_AND_ASSIGN (mi_parse);
 
-    enum mi_command_type op;
-    char *command;
-    char *token;
-    const struct mi_command *cmd;
-    struct mi_timestamp *cmd_start;
-    char *args;
-    char **argv;
-    int argc;
-    int all;
-    int thread_group; /* At present, the same as inferior number.  */
-    int thread;
-    int frame;
+    enum mi_command_type op = MI_COMMAND;
+    char *command = nullptr;
+    char *token = nullptr;
+    const struct mi_command *cmd = nullptr;
+    struct mi_timestamp *cmd_start = nullptr;
+    char *args = nullptr;
+    char **argv = nullptr;
+    int argc = 0;
+    int all = 0;
+    int thread_group = -1; /* At present, the same as inferior number.  */
+    int thread = -1;
+    int frame = -1;
 
     /* The language that should be used to evaluate the MI command.
        Ignored if set to language_unknown.  */
-    enum language language;
+    enum language language = language_unknown;
   };
 
 /* Attempts to parse CMD returning a ``struct mi_parse''.  If CMD is

^ 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] Use member initializers in mi_parse 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).