nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9988d254fedb77a9fe0685efa3853ccfb144cec3
parent 1baf2843693ed78086fa01654b31f163fc9c2a33
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sun,  8 Sep 2019 14:05:02 +0530

Fix xitoa()

Diffstat:
Msrc/nnn.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 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];