Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] remote: C++ify thread_item and threads_listing_context
Date: Thu, 23 Nov 2017 16:52:00 -0000	[thread overview]
Message-ID: <9b972862-115b-fe23-4ce9-d641a7b6fe7e@redhat.com> (raw)
In-Reply-To: <fda4cade16c49231493fd26916369cc1@polymtl.ca>


On 11/23/2017 04:48 PM, Simon Marchi wrote:
> On 2017-11-23 09:22, Pedro Alves wrote:

>>> @@ -3109,37 +3105,28 @@ start_thread (struct gdb_xml_parser *parser,
>>>  {
>>
>>>    attr = xml_find_attribute (attributes, "name");
>>> -  item.name = attr != NULL ? xstrdup ((const char *) attr->value) :
>>> NULL;
>>> +  if (attr != NULL)
>>> +    item.name = (const char *) attr->value;
>>
>> Are you missing the xstrdup here?  I guess this is related to
>> the awkwardness you mentioned.
> 
> I don't think so, here item.name is an std::string, so the assignment
> does a copy.  This copy is required I think, because attr->value won't
> exist after we're done parsing the XML.
> 
>>> @@ -3150,8 +3137,8 @@ end_thread (struct gdb_xml_parser *parser,
>>>    struct threads_listing_context *data
>>>      = (struct threads_listing_context *) user_data;
>>>
>>> -  if (body_text && *body_text)
>>> -    VEC_last (thread_item_t, data->items)->extra = xstrdup (body_text);
>>> +  if (body_text != NULL && *body_text != '\0')
>>> +    data->items.back ().extra = body_text;
>>
>> And here?
> 
> Same, extra is an std::string.

Right, sorry, glanced over that too quickly.  :-P

Thanks,
Pedro Alves


  reply	other threads:[~2017-11-23 16:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 16:41 [PATCH 0/4] Poison XNEW and friends for non-POD types Simon Marchi
2017-11-22 16:41 ` [PATCH 1/4] Create private_inferior class hierarchy Simon Marchi
2017-11-22 22:20   ` Joel Brobecker
2017-11-24 15:46     ` Simon Marchi
2017-11-24 21:31       ` Joel Brobecker
2017-11-23 14:09   ` Pedro Alves
2017-11-23 16:17     ` Simon Marchi
2017-11-22 16:42 ` [PATCH 4/4] Poison XNEW and friends for types that should use new/delete Simon Marchi
2017-11-23 15:02   ` Pedro Alves
2017-11-23 17:27     ` Simon Marchi
2017-11-23 17:31       ` Pedro Alves
2017-11-22 16:42 ` [PATCH 2/4] remote: C++ify thread_item and threads_listing_context Simon Marchi
2017-11-23 14:22   ` Pedro Alves
2017-11-23 16:48     ` Simon Marchi
2017-11-23 16:52       ` Pedro Alves [this message]
2017-11-22 16:42 ` [PATCH 3/4] Create private_thread_info hierarchy Simon Marchi
2017-11-23 14:41   ` Pedro Alves
2017-11-23 16:54     ` Simon Marchi
2017-11-23 16:56       ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b972862-115b-fe23-4ce9-d641a7b6fe7e@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox