aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-09-08 14:05:02 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-09-08 14:05:02 +0530
commit9988d254fedb77a9fe0685efa3853ccfb144cec3 (patch)
tree5bebb07d97f5cab3afda9ff3094b1781ea2686d7 /src
parent1baf2843693ed78086fa01654b31f163fc9c2a33 (diff)
downloadnnn-9988d254fedb77a9fe0685efa3853ccfb144cec3.tar.gz
Fix xitoa()
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 01565dc..1631348 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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];