[PATCH] unify itoa
Denis Vlasenko
vda.linux at googlemail.com
Sat Jul 8 16:44:18 UTC 2006
Hi folks, Rob,
Attached patch removes all instances of local itoa()-like
functions, introduces common one into libbb and uses
it where appropriate.
The itoa which lives in ash is not converted:
/* Our own itoa(). */
static int
cvtnum(arith_t num)
{
int len;
expdest = makestrspace(32, expdest);
#ifdef CONFIG_ASH_MATH_SUPPORT_64
len = fmtstr(expdest, 32, "%lld", (long long) num);
#else
len = fmtstr(expdest, 32, "%ld", num);
#endif
STADJUST(len, expdest);
return len;
}
Where fmtstr is:
int
fmtstr(char *outbuf, size_t length, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
INTOFF;
ret = vsnprintf(outbuf, length, fmt, ap);
va_end(ap);
INTON;
return ret;
}
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.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox_itoa.patch
Type: text/x-diff
Size: 8832 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060708/b7e27d7b/attachment.bin
More information about the busybox
mailing list