From owner-svn-src-head@freebsd.org Mon Aug 31 14:44:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31EBA3C3A90; Mon, 31 Aug 2020 14:44:58 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BgCfL0bNzz4bSJ; Mon, 31 Aug 2020 14:44:58 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f1a2a00693712683f862fe0.dip0.t-ipconnect.de [IPv6:2003:cd:5f1a:2a00:6937:1268:3f86:2fe0]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 347C82EEAB; Mon, 31 Aug 2020 14:44:57 +0000 (UTC) (envelope-from se@freebsd.org) To: rgrimes@freebsd.org Cc: src-committers , svn-src-all , svn-src-head , Ed Maste References: <202008311409.07VE9Ch9033206@gndrsh.dnsmgr.net> From: Stefan Esser Subject: Re: svn commit: r364321 - head/sbin/ipfw Message-ID: <4e233a60-33cc-69db-3f2a-faf3b0c8d4f0@freebsd.org> Date: Mon, 31 Aug 2020 16:44:55 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.2.1 MIME-Version: 1.0 In-Reply-To: <202008311409.07VE9Ch9033206@gndrsh.dnsmgr.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0gFKOi6mQqYhil7lFogP9OYGYXnfkj6Tl" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 14:44:58 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0gFKOi6mQqYhil7lFogP9OYGYXnfkj6Tl Content-Type: multipart/mixed; boundary="7gs3ivT7ODwDWMxtCYESrYXquYtN34LIB"; protected-headers="v1" From: Stefan Esser To: rgrimes@freebsd.org Cc: src-committers , svn-src-all , svn-src-head , Ed Maste Message-ID: <4e233a60-33cc-69db-3f2a-faf3b0c8d4f0@freebsd.org> Subject: Re: svn commit: r364321 - head/sbin/ipfw References: <202008311409.07VE9Ch9033206@gndrsh.dnsmgr.net> In-Reply-To: <202008311409.07VE9Ch9033206@gndrsh.dnsmgr.net> --7gs3ivT7ODwDWMxtCYESrYXquYtN34LIB Content-Type: multipart/mixed; boundary="------------99325335DA063CBDB4C12FA2" Content-Language: en-US This is a multi-part message in MIME format. --------------99325335DA063CBDB4C12FA2 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 31.08.20 um 16:09 schrieb Rodney W. Grimes: >> Hrm, it seems this reply ended up in my spam folder; sorry for not >> replying until now. >=20 > lol Oh, bad filter :-) >=20 >>>> *strchr(timestr, '\n') =3D '\0'; >>>> bprintf(bp, "%s ", timestr); >>> ^ Isnt this the +1 space? >>> >>>> } else { >>>> - bprintf(bp, "%*s", twidth, " "); >>>> + bprintf(bp, "%*s", twidth + 1, " "); >>> ^missing from this string? >> >> Inserting an extra space in the format string would also work, sure. I= >> considered doing it that way but in the end decided it's not >> materially more clear one way or another, so used the patch as >> submitted. >=20 > For me the + 1 leads to a "why is this here", where as the space > in the format string clearly matches the other condition of the else. In this case it doesn't seem to make much of a difference, since the string passed is just a blank character (and it does not make any difference whether a blank is inserted before or behind it). But in general, I'd rather see "%*s " as the format (which makes it clear, that the blank is inserted behind the string argument referenced by %s, not to the left of it - or " %*s" for the other placement of the extra blank). But in this particular case I'd use printf(bp, "%*s ", twidth, ""); since there is no need to pass a non-zero length argument for %s and I'd think that the purpose of the format string is to make the columns line up and then to provide one additional blank as a separator for maximum length values. Adding 1 to the width argument of "%*s" adds blanks to the left of the string, which is obvious given the semantics of the format string, but still takes some thinking compared to trivially seeing the place where the extra blank is put in a format string ... > Also + 1 causes a run time computation, the extra space does not. Well, the parsing of the extra blank in the format string can be assumed to cost more cycles than the increment of a variable plus the extra loop iteration it causes for the alignment blanks that are written. But the code length will be shorter with the blank in the format string and the extra cycles will be irrelevant ... Regards, STefan --------------99325335DA063CBDB4C12FA2-- --7gs3ivT7ODwDWMxtCYESrYXquYtN34LIB-- --0gFKOi6mQqYhil7lFogP9OYGYXnfkj6Tl Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFqEEo3HqZZwL7MgrcVMTR+u171r99UQFAl9NDOcFAwAAAAAACgkQR+u171r99UTX Uwf/XuZej6pwHQTRPhhEmaI2kgkVK+2j1RXeZJX6fFqpCKM0f2aGMpQuVeNIeBXaZKoJQH2yPv0x GowThwwF94r06wU/1LP8xtVSnwdFWUtXvUNLAneyTtGGUuP9T9/KXxarQO/QDWM7ajlvunXG1Bve zFxUc/sWZVaTcSBfLsb9Y+KnnMGIJc8J9c+Wab6bWdkmBTosBv6oeodzlh3kBNja+I+TdlDhP02X 2/d6+qFzMbWRiXF+BtR2/uS9aHhEUq9fRfXlzbHteLSg2fnX2nPUAcCRH8VQ/glZARfdKJZNzdB6 ckZIOQVD1K5iNBBQkHkiA6W66tj8BxV/wfFWKvTgTg== =ec9/ -----END PGP SIGNATURE----- --0gFKOi6mQqYhil7lFogP9OYGYXnfkj6Tl--