Fix xitoa()

This commit is contained in:
Arun Prakash Jana 2019-09-08 14:05:02 +05:30
parent 1baf284369
commit 9988d254fe
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 5 additions and 2 deletions

View File

@ -536,9 +536,12 @@ static uint xatoi(const char *str)
static char *xitoa(uint val)
{
static char ascbuf[32] = {0};
int i;
int i = 30;
for (i = 30; val && i; --i, val /= 10)
if (!val)
return "0";
for (; val && i; --i, val /= 10)
ascbuf[i] = '0' + (val % 10);
return &ascbuf[++i];