mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [PATCH] simplify __procfdname by folding the 0 case
Date: Mon, 10 Sep 2018 00:30:50 +0300 (MSK)	[thread overview]
Message-ID: <alpine.LNX.2.20.13.1809100026500.28763@monopod.intra.ispras.ru> (raw)
In-Reply-To: <CAN30aBG+7j6Ki3Q3s-0M7CFFa_XFw4cdg7HuOr5B=_FgF_qbDg@mail.gmail.com>

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

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

      reply	other threads:[~2018-09-09 21:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-02  7:51 Fangrui Song
2018-09-02 11:14 ` Alexander Monakov
2018-09-09 19:04   ` Fāng-ruì Sòng
2018-09-09 21:30     ` Alexander Monakov [this message]

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=alpine.LNX.2.20.13.1809100026500.28763@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).