Received: by 10.223.185.116 with SMTP id b49csp303032wrg; Fri, 2 Mar 2018 19:46:38 -0800 (PST) X-Google-Smtp-Source: AG47ELsUNiCFSf6oyi+QloOKVYRdNjbPKcd7gtB+m0NIoBze8eVeTec9NmlJEXfQZJgF5iFoOJ6p X-Received: by 10.98.165.4 with SMTP id v4mr2674145pfm.51.1520048798752; Fri, 02 Mar 2018 19:46:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520048798; cv=none; d=google.com; s=arc-20160816; b=Nz+URkH3+AfiifMl7RnP/vJgbE1tvyC93P2fVXfg2wW8DjgWi6NgiBSAbgOk98lqPa vZAGbVyGSDROJxhcuy/41iqDtc7C+AHXzQNUAxxeQW/Ax3eOKBbPSA36nGdsdBX9dX/C CJG5M+OLqQUXu5T5p8xEPbwOokZ12zEm6cuz9/K0xm1OVPWUQYJlIYFzU9fzPUPYQPeY oFviDSU5s/anrJo94ROHRaVGK/oL6Bfg8LO1YEq89GINvwipLB6iGyf0qsiYfP9PeaQg X3FahJDV+uw4nsdf0am7EJrwChpcwjaiUA541ow6kJj0VXkTGSKD9rlRslsGehmV5Ii4 fMRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=eKhTuSOWeV+T5Z5WPa41mQK5S7hgh5gS2eCLDLnFGAI=; b=y2rGFovIy3R+74IKjJqkCrVMlEzqFg2uAkzUOC45CopqJns79wZhqlOn+OhSpznV7c XcqNg/Jsqx1limgFKc5ufhkiCJXgnT/c5VydhmRnZhAaKV/spUEvaqic8MBvRMw9W72m EMZ0RkzPn8rTd611oUTlheSJWZbmF9vPYElHzYGeMwJAigVbSf/bh9/hs7g7oiCjpJI6 dNS95k+CNI6UGjb8E7cl8qtlZ7t9Jj7g6BePigcbfD4TOCHH5NIwwShHHOkJSCDE+6jt lkQBVNYpS4h0UauQSPWg8+xCgWDMqR3LnGGvYVI/EiK0D34/aKOGlgF4iel9jLA/LUT5 Y+RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XmVHO7Sy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f185si4938761pgc.202.2018.03.02.19.46.24; Fri, 02 Mar 2018 19:46:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XmVHO7Sy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934509AbeCBXND (ORCPT + 99 others); Fri, 2 Mar 2018 18:13:03 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33956 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934345AbeCBXNB (ORCPT ); Fri, 2 Mar 2018 18:13:01 -0500 Received: by mail-pf0-f196.google.com with SMTP id j20so4619972pfi.1; Fri, 02 Mar 2018 15:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eKhTuSOWeV+T5Z5WPa41mQK5S7hgh5gS2eCLDLnFGAI=; b=XmVHO7SytAQQsGbf8NdWEoqchOQGp7pLDzOC54TiX82taIpURPvenpeDx2xwLeS2L2 zaby7mzCd5L9N6AdhEWKqYTZxXCMx9SaTXtmCESlfrgm4pDOL2gEOp2IMX690GLxvo/N ay9Y5ylBv4ttaY0vGzlOHYj3x/TXdxEYb7ZINLqGHro+5hAxwmJx1sMOGunuEbWNYPJ6 mzlRVOJ4Lucs7OkzgY0yfpkpGShib+BWtr0c655TmZ90Y8aPMxgJHR/zHVcbMmR3FDtl AE43u+rs2pgIUIapoqRa9vECXMnOYbpxVRiA1Nro8GkZtm93PWElIeZ/gKUCggchlgTF BeWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eKhTuSOWeV+T5Z5WPa41mQK5S7hgh5gS2eCLDLnFGAI=; b=DKVO5KWsk42zo+iKMqqWoXeaXiujPjDx4PBcmXJfIQH18n0OKVAMXKBYNDDtuymlyg EqnO9nQrHiaLVWw/hL6E8M74DJ1044iSetm4eliQ0xG7zgnOqX6IFnZNnrWiKbMDvuEa rsmd1GlDoE9sQJZTLTw3zLpa0mlg+9IasgEEdGAlxpjhiGfVSLUNtuWMwqDYILGmYhUo B7yQCr2svFt5do2mS3h0d1Ip2rGRr2HS9NvsKaTuj2MxqH0cTv6auQmLu7pOAu5/zfao S3Hcx0yxwIgPx2gjsxpMm0rJlk49VQLKy6KtbD4zg0FvGJio3AJaSZZOEJ6u5RZZJqw0 cJww== X-Gm-Message-State: APf1xPDIV+r3bhKPw8fFQ57e6QX1yY2pZDIspbxdi831ROEDvHnYFwxQ BCeh2nlAdSy7ynBzS67L0EQ= X-Received: by 10.98.178.17 with SMTP id x17mr7286759pfe.2.1520032381131; Fri, 02 Mar 2018 15:13:01 -0800 (PST) Received: from gmail.com ([2605:e000:1117:c19a:2e0:1bff:fe70:ea]) by smtp.gmail.com with ESMTPSA id 10sm12070457pgg.73.2018.03.02.15.12.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Mar 2018 15:12:59 -0800 (PST) Date: Fri, 2 Mar 2018 13:12:56 -1000 From: Joey Pabalinas To: Ulf Magnusson Cc: linux-kbuild@vger.kernel.org, Arnaud Lacombe , Masahiro Yamada , Linux Kernel Mailing List Subject: Re: [PATCH] scripts/kconfig: replace single character strcat() appends Message-ID: <20180302231256.4aevdu2b5ylyrzkr@gmail.com> References: <20180302074424.2myh3zhxnbpaohjq@gmail.com> <20180302134453.mtd4uepeiviicyef@huvuddator> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5c6njx6tk3sxs4db" Content-Disposition: inline In-Reply-To: <20180302134453.mtd4uepeiviicyef@huvuddator> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5c6njx6tk3sxs4db Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > 1. Rename the 'in' parameter to 's'. > 2. Rename 'p' to 'in'. > 3. Rename 'end' to 'out' >=20 > At that point, you're reading from 'in' and writing to 'out', which > seems pretty nice and readable. >=20 > 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). >=20 > 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! --=20 Cheers, Joey Pabalinas --5c6njx6tk3sxs4db Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKlZXrihdNOcUPZTNruvLfWhyVBkFAlqZ2ngACgkQruvLfWhy VBl/2hAA0tVRbvfSQVQv/LRD8Wp+CAcnvnLwI4VPp0vrCh/f/oxqUV533/6Cj2o6 0AatrgS4Qa1VyiIZjaMUaerwnzsWQAnBA2+iXpP5RbcicreMCfN/YI6qtr/brzvR Q35wOtU6QqM6s4tg5Se0gS71UkgPgItwRLN4tZoGCSWooBPjOtU58tY69YzxJVBk Vi1Os3RiuJzMwEjdv/ztwjSTWN37op9ZwjFFB9X7WEGiJw3VI8iZ5fANI0OR+niH 6QTp4Hmz1OzHqze837pn7T8xY02pwU2IsZkGAWxrdZgPip1iTaQxEOQGLNWSSvQ9 WWmd/H2a0+ifxx22FdtFhBviip+gK0xcSCYaOeh8MVphWwuWsC7FCWmszw8H2blz 47SfjCsHsAKisxwCMIZH/q2YegFUvqjKnfQ1aK2AmgWvek44oknDUA40XHQyUQyw Cl8/Rr+LTTcAtX+Xb4HDOOflSQq5YpX6N4ZwxI6z0wuxdcnLQM3KSgACjdrgp+YS TfvHu+jabiI5p/Wi7SQ+Otw3imAzrexfX42GPnno0xGPOrgleBAuNgMq9P99rMf4 5WkqKFOdqRh6w9sSFQvzLQdEltXgfxkZxm+sevao70YFE98rutIOrd2/V+Qrs8wt nVjQeN3BSxUl/msIuTmK6g584+6QvSL7N5IGNnkXzI7XUpnLWqA= =Uaaf -----END PGP SIGNATURE----- --5c6njx6tk3sxs4db--