Re: [PATCH] fix potential infinite loop given large unsigned integer
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Aug 10, 2009, 05:24 UTC
- Message-ID
- <200908100724.53345.chriscool@tuxfamily.org>
- In-Reply-To
- <40aa078e0908090525h7b4d6efeh658e2edcfbe16c7e@mail.gmail.com>
On Sunday 09 August 2009, Erik Faye-Lund wrote:
Show 13 quoted lines
> 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.