public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Joey Pabalinas <joeypabalinas@gmail.com>
To: Ulf Magnusson <ulfalizer@gmail.com>
Cc: linux-kbuild@vger.kernel.org, Arnaud Lacombe <lacombar@gmail.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scripts/kconfig: replace single character strcat() appends
Date: Fri, 2 Mar 2018 13:12:56 -1000	[thread overview]
Message-ID: <20180302231256.4aevdu2b5ylyrzkr@gmail.com> (raw)
In-Reply-To: <20180302134453.mtd4uepeiviicyef@huvuddator>

[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

On Fri, Mar 02, 2018 at 02:44:53PM +0100, Ulf Magnusson wrote:
> Not sure this is an improvement. Zeroing the bytes after the initial
> null terminator is redundant, and the explicit '\0' makes it clearer to
> me what's going on.

Yes, I agree with you, that is definitely quite true. This along with
the other comments you made me want to rethink this a little bit.

On Fri, Mar 02, 2018 at 02:44:53PM +0100, Ulf Magnusson wrote:
> I like the approach, but I wonder if we can take it a bit further.
> Here's what I'd do:
> 
> 	1. Rename the 'in' parameter to 's'.
> 	2. Rename 'p' to 'in'.
> 	3. Rename 'end' to 'out'
> 
> At that point, you're reading from 'in' and writing to 'out', which
> seems pretty nice and readable.
> 
> This code is pretty cold by the way, so it wouldn't matter for
> performance. GCC knows how functions like strcat() work too, and uses
> that to optimize (see
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html).
> 
> I'm all for trying to make Kconfig's code neater though.

Since this code is pretty cold (completely agree with you there), I
think it would actually be much more useful to rework my patch to
have a more style-centric approach rather than an optimization-centric
one; this code would definitely benefit from being neater.

Some useful changes would be to rename of the _atrociously_ short
identifiers like p and l.

Anyway I'll give that link a read over and try and make a V2 later
on today.

Appreciate the feedback, thanks for the comments!

-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-03-02 23:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02  7:44 [PATCH] scripts/kconfig: replace single character strcat() appends Joey Pabalinas
2018-03-02 13:44 ` Ulf Magnusson
2018-03-02 23:12   ` Joey Pabalinas [this message]
2018-03-03 18:14     ` Ulf Magnusson
2018-03-03 18:23       ` Ulf Magnusson
  -- strict thread matches above, loose matches on Subject: below --
2018-03-02  7:38 Joey Pabalinas

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=20180302231256.4aevdu2b5ylyrzkr@gmail.com \
    --to=joeypabalinas@gmail.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ulfalizer@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /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