From owner-svn-src-all@FreeBSD.ORG Mon Mar 19 02:32:18 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6402E106564A; Mon, 19 Mar 2012 02:32:18 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 19FF48FC14; Mon, 19 Mar 2012 02:32:14 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id q2J2W7XV089805; Mon, 19 Mar 2012 02:32:07 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.119] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 74sitbxu8cehhdt79hbbq52guw; Mon, 19 Mar 2012 02:32:06 +0000 (UTC) (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: <20120319021724.GC13456@DataIX.net> Date: Sun, 18 Mar 2012 19:32:04 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> <20120319021724.GC13456@DataIX.net> To: Jason Hellenthal X-Mailer: Apple Mail (2.1257) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:32:18 -0000 On Mar 18, 2012, at 7:17 PM, Jason Hellenthal wrote: >=20 >=20 > On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: >> On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal >> wrote: >>>=20 >>>=20 >>> On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: >>>> Author: eadler >>>> Date: Mon Mar 19 01:27:55 2012 >>>> New Revision: 233147 >>>> URL: http://svn.freebsd.org/changeset/base/233147 >>>>=20 >>>> Log: >>>> MFC r232503: >>>> POSIX mandates that swab do nothing when len < 0 >>>>=20 >>>> PR: 140690 >>>> Approved by: cperciva >>>>=20 >>>> Modified: stable/8/lib/libc/string/swab.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 = (r233146) >>>> +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 = (r233147) >>>> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void >>>> int n; >>>> char *fp, *tp; >>>>=20 >>>> + if (len <=3D 0) >>>> + return; >>>=20 >>> Does this not test to see if it is also equal to 0(zero) ? >>>=20 >>> If I understand the above statement "POSIX mandates that swab do = nothing >>> when len < 0" then the above code should be exactly that ... and not >>> testing whether it is equal to zero... >>=20 >> If the code doesn't check for len <=3D 0 then it will do something. >>=20 >=20 > To my understanding of the specification it should only return if len = is > negative... 0 is not a negative number. =46rom POSIX: > The swab() function shall copy nbytes bytes=85 This implies that it does nothing when the argument is zero. The check for <=3D 0 is a performance optimization; otherwise the code will do nothing in a more expensive fashion. > If nbytes is negative, swab() does nothing. This states that it does nothing when the argument is less than zero. So the change is correct; it covers both cases. Tim