[PATCH] unify itoa

Rob Landley rob at landley.net
Sat Jul 8 10:45:50 PDT 2006


On Saturday 08 July 2006 12:44 pm, Denis Vlasenko wrote:
> Hi folks, Rob,
>
> Attached patch removes all instances of local itoa()-like
> functions, introduces common one into libbb and uses
> it where appropriate.

Is "sprintf" really that bad?  (Or xasprintf() out of our library when you 
need it to malloc?)  Especially if the darn compiler actually starts doing 
intelligent string merging, which it's inching towards...

You have a large quantity of code under #ifdef NOT_NEEDED_YET that by itself 
would make me reject this patch.  (What's max_unsigned_power10() doing, 
anyway, and is that really a sane way to do whatever it is?)

> If you want it converted too, I'll do it. itoa.c
> already has code which can handle unsigned long long conv,
> it is #ifdef'ed out for now. See the patch.

It can handle int, and long long, but not long.  On 64 bit platforms (we 
already support x86-64, and this sort of thing will only get more common to 
the point it may be a noticeable chunk of the embedded space in 3-5 years), 
these are three different sizes.

Rob
-- 
Never bet against the cheap plastic solution.


More information about the busybox mailing list