Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] [gdb/symtab] Simplify memory management in parse_macro_definition
Date: Mon, 29 Jul 2024 12:28:20 -0400	[thread overview]
Message-ID: <bc7615fe-f435-4af7-9f02-259dc01f7876@simark.ca> (raw)
In-Reply-To: <78ab9c10-a0f4-4b23-8486-c9655f2194b8@suse.de>

On 7/29/24 12:13 PM, Tom de Vries wrote:
> On 7/24/24 18:12, Tom de Vries wrote:
>> On 7/24/24 18:07, Simon Marchi wrote:
>>> On 6/26/24 2:32 AM, Tom de Vries wrote:
>>>> I noticed that parse_macro_definition does malloc and free, both for the
>>>> argv array and its elements.
>>>>
>>>> Make memory management simpler by introducing a new class
>>>> vector_c_string (copied from temporary_macro_definition here [1]) that uses an
>>>> std::vector for the argv array.
>>>
>>> Is there a reason to keep using C strings here, instead of a let's say,
>>> a vector of std::string?  I gave it a quick try, I have something that
>>> builds, just need to test and polish it.
>>>
>>
>> Hi Simon,
>>
>> thanks for the review.
>>
>> No, not really, my main goal here is the ability to do a return in parse_macro_definition without introducing a memory leak.
>>
>> So that sounds fine to me.
>>
> 
> I've looked at the patch.
> 
> I've was thrown astray a bit about the macro_special_kind business, until I realized it was a pre-existing notion.

Yeah, I think it's a bit clearer with my change, we don't use that int
parameter for multiple purposes, including passing an enum.

> Anyway, patch LGTM.
> 
> Tested on x86_64-linux, no issues found.

For clarity, can you give your approval on the version I posted here?
Sorry, it wasn't clear that I posted it on the list.

https://inbox.sourceware.org/gdb-patches/20240724190833.69587-1-simon.marchi@efficios.com/#r

Simon

      reply	other threads:[~2024-07-29 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  6:32 Tom de Vries
2024-07-24 14:46 ` [PING] " Tom de Vries
2024-07-24 16:07 ` Simon Marchi
2024-07-24 16:12   ` Tom de Vries
2024-07-29 16:13     ` Tom de Vries
2024-07-29 16:28       ` Simon Marchi [this message]

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=bc7615fe-f435-4af7-9f02-259dc01f7876@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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