Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Sergio Durigan Junior <sergiodj@sergiodj.net>
Cc: Mark Wielaard <mark@klomp.org>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Search for DWZ files in debug-file-directories as well
Date: Sat, 28 Nov 2020 17:12:21 -0500	[thread overview]
Message-ID: <bfeb19d9-ce0f-7960-c78f-46dccb2cb863@simark.ca> (raw)
In-Reply-To: <87zh31yza7.fsf@paluero>

On 2020-11-28 3:58 p.m., Sergio Durigan Junior wrote:
>> I think it would be more readable and efficient (less bytes copied
>> around) to do just build the new_filename string with something like:
>>
>>   std::string new_filename = debugdir + &filename[dwz_pos];
>>
>> This is untested, but I think you'll get the point.  &filename[dwz_pos]
>> could also be put into a variable with a meaningful name, for clarity
>> (though I can't think of a good name right now).
>
> It is more efficient, but using .erase + .insert can be more readable.
> But OK, I don't have a strong opinion here.

Well, I suggested the other way because I think that is more readable
:).  I see it more as "the new path is made of this part plus that
part".  I'll let you choose what you prefer, it's not code that needs to
be extremely optimized anyway.

>> And we probably don't need the allocated `ddir` std::string, you
>> construct it but never really use it (you could just refer to debugdir).
>
> I'll need it for the new version of the code, which will implement the
> idea I gave above (always guaranteeing that ddir ends with
> DIR_SEPARATOR).

Ok, if you do that I think you can move ddir out of the loop, it doesn't
need to be re-computed for each loop iteration.

Simon

  parent reply	other threads:[~2020-11-28 22:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 23:48 [PATCH] " Sergio Durigan Junior via Gdb-patches
2020-11-15 13:19 ` Mark Wielaard
2020-11-16  1:25 ` Simon Marchi
2020-11-16  9:32   ` Mark Wielaard
2020-11-16 17:57   ` Sergio Durigan Junior via Gdb-patches
2020-11-19  2:27 ` [PATCH v2] " Sergio Durigan Junior via Gdb-patches
2020-11-25 15:09   ` Sergio Durigan Junior via Gdb-patches
2020-11-25 16:58   ` Luis Machado via Gdb-patches
2020-11-28 20:51     ` Sergio Durigan Junior via Gdb-patches
2020-11-26 16:53   ` Simon Marchi
2020-11-28 20:58     ` Sergio Durigan Junior via Gdb-patches
2020-11-28 21:35       ` Sergio Durigan Junior via Gdb-patches
2020-11-28 22:13         ` Simon Marchi
2020-11-28 22:12       ` Simon Marchi [this message]
2020-11-29  0:57         ` Sergio Durigan Junior via Gdb-patches
2020-11-29  1:29           ` Simon Marchi
2020-11-29  1:08 ` [PATCH v3] " Sergio Durigan Junior via Gdb-patches
2020-12-01 14:45   ` Simon Marchi
2020-12-02  3:08     ` Sergio Durigan Junior via Gdb-patches

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=bfeb19d9-ce0f-7960-c78f-46dccb2cb863@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=mark@klomp.org \
    --cc=sergiodj@sergiodj.net \
    /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