From: Christian Couder <chriscool@tuxfamily.org>
To: Erik Faye-Lund <kusmabite@googlemail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Ryan Flynn <parseerror@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] fix potential infinite loop given large unsigned integer
Date: Mon, 10 Aug 2009 07:24:52 +0200 [thread overview]
Message-ID: <200908100724.53345.chriscool@tuxfamily.org> (raw)
In-Reply-To: <40aa078e0908090525h7b4d6efeh658e2edcfbe16c7e@mail.gmail.com>
On Sunday 09 August 2009, Erik Faye-Lund wrote:
> On Sun, Aug 9, 2009 at 9:38 AM, Junio C Hamano<gitster@pobox.com> wrote:
> > + static char num_buf[64];
> > rev.total = total + start_number - 1;
> > + sprintf(num_buf, "%d", rev.total);
> > + rev.num_width = strlen(num_buf);
>
> how about
> rev.num_width = (int)log10((double)rev.total) + 1;
>
> hm?
>
> log10() appears to be C99, but can be emulated on earlier C-versions by
> doing #define log10(x) (log(x) / log(10.0))
That would mean linking with -lm?
Regards,
Christian.
next prev parent reply other threads:[~2009-08-10 5:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 4:41 [PATCH] fix potential infinite loop given large unsigned integer Ryan Flynn
2009-08-09 6:19 ` Junio C Hamano
2009-08-09 7:38 ` Junio C Hamano
2009-08-09 12:25 ` Erik Faye-Lund
2009-08-10 5:24 ` Christian Couder [this message]
2009-08-10 11:12 ` Erik Faye-Lund
2009-08-10 12:24 ` Johannes Schindelin
2009-08-10 16:14 ` Ryan Flynn
2009-08-10 16:17 ` Ryan Flynn
2009-08-10 16:53 ` Johannes Schindelin
2009-08-11 0:55 ` Jeff Epler
2009-08-10 0:23 ` Ryan Flynn
2009-08-10 18:19 ` Tony Finch
2009-08-09 23:16 ` Ryan Flynn
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=200908100724.53345.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kusmabite@googlemail.com \
--cc=parseerror@gmail.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.
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).