From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13218 Path: news.gmane.org!.POSTED!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] simplify __procfdname by folding the 0 case Date: Mon, 10 Sep 2018 00:30:50 +0300 (MSK) Message-ID: References: <5b8b9a8b.1c69fb81.ed159.bb37@mx.google.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="168458499-488838265-1536528650=:28763" X-Trace: blaine.gmane.org 1536528538 24300 195.159.176.226 (9 Sep 2018 21:28:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Sep 2018 21:28:58 +0000 (UTC) User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) To: musl@lists.openwall.com Original-X-From: musl-return-13234-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 09 23:28:54 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fz7GH-0006E9-LU for gllmg-musl@m.gmane.org; Sun, 09 Sep 2018 23:28:53 +0200 Original-Received: (qmail 20398 invoked by uid 550); 9 Sep 2018 21:31:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 20380 invoked from network); 9 Sep 2018 21:31:01 -0000 In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:13218 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --168458499-488838265-1536528650=:28763 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Sun, 9 Sep 2018, Fāng-ruì Sòng wrote: > > > - for (; fd; fd/=10) buf[--i] = '0' + fd%10; > > > + for (j=fd; i++, j /= 10; ); > > > > This is not correct as it only increments i once. A do-while loop would do > > the > > job better here. > > > > May I defend for myself? for (j=fd; i++, j /= 10; ); > i++ is in the loop condition so it will be incremented multiple times. Sorry, my mistake there (I misread the change). Alexander --168458499-488838265-1536528650=:28763--