This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA v2 10/17] C++ify mi_parse


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> The patch made mi_parse be a non-POD (non-trivial dtor), so I
Pedro> think we should get rid of that memset at the same time.

This change was a little bigger than the others.  I've added this
constructor:

    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)
    {
    }

... and changed the construction of the object like:

@@ -241,12 +241,5 @@
 
-  memset (parse, 0, sizeof (*parse));
-  parse->all = 0;
-  parse->thread_group = -1;
-  parse->thread = -1;
-  parse->frame = -1;
-  parse->language = language_unknown;
-
-  cleanup = make_cleanup (mi_parse_cleanup, parse);
+  std::unique_ptr<struct mi_parse> parse (new struct mi_parse);
 
   /* Before starting, skip leading white space.  */
   cmd = skip_spaces_const (cmd);

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]