public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] [gdb/tui] Use const std::string for string literals in tui-stack.c
Date: Tue, 28 Nov 2023 16:34:45 +0100	[thread overview]
Message-ID: <013dc83b-5c55-4a1f-b606-433a44bb6810@suse.de> (raw)
In-Reply-To: <CAJVr-ENmKj7tP34gZpFrjGCZtzW-6LjTuqKfR+OC0fsytTotjA@mail.gmail.com>

On 11/28/23 10:19, Alexandra Petlanova Hajkova wrote:
> 
> 
> On Mon, Nov 27, 2023 at 4:39 AM Tom de Vries <tdevries@suse.de 
> <mailto:tdevries@suse.de>> wrote:
> 
>     I noticed in gdb/tui/tui-stack.c a source-level micro-optimization where
>     strlen with a string literal argument:
>     ...
>     strlen ("bla")
>     ...
>     is replaced with sizeof:
>     ...
>     sizeof ("bla") - 1
>     ...
> 
>     The benefit of this is that the optimization is also done at O0, but the
>     drawback is that it makes expression harder to read.
> 
>     Use const std::string to encapsulate the string literals, and use
>     std::string::size () instead.
> 
>     I tried making the string names (PROC_PREFIX, LINE_PREFIX, PC_PREFIX and
>     SINGLE_KEY) lower-case, but that clashed with a pre-existing
>     pc_prefix, so
>     I've them upper-case.
> 
>     Tested on x86_64-linux.
> 
> 
> The last paragraph of the commit message sounds a bit confusing, I mean 
> "I've them upper-case".
 > Maybe you could rephrase it?

Hi,

thanks for the review.

I've added the missing "left" in the sentence, thanks for spotting that.

> I can confirm  the change adds no regressions on ppc64le Fedora Rawhide.

I've added a tested-by tag, and committed.

Thanks,
- Tom

      reply	other threads:[~2023-11-28 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  3:39 Tom de Vries
2023-11-27  3:39 ` [PATCH 2/2] [gdb/tui] Show focus window in status line Tom de Vries
2023-11-28 15:22   ` Alexandra Petlanova Hajkova
2023-11-28 17:03     ` Tom de Vries
2023-11-28  9:19 ` [PATCH 1/2] [gdb/tui] Use const std::string for string literals in tui-stack.c Alexandra Petlanova Hajkova
2023-11-28 15:34   ` Tom de Vries [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=013dc83b-5c55-4a1f-b606-433a44bb6810@suse.de \
    --to=tdevries@suse.de \
    --cc=ahajkova@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).