mirror of
https://github.com/jarun/nnn.git
synced 2025-03-18 20:39:45 +00:00
Initialize once
This commit is contained in:
parent
ed23e494a9
commit
dd5588650d
1 changed files with 5 additions and 7 deletions
12
src/nnn.c
12
src/nnn.c
|
@ -799,21 +799,19 @@ static void clean_exit_sighandler(int UNUSED(sig))
|
||||||
|
|
||||||
static char *xitoa(uint_t val)
|
static char *xitoa(uint_t val)
|
||||||
{
|
{
|
||||||
static char dst[32];
|
static char dst[32] = {'\0'};
|
||||||
static const char digits[201] =
|
static const char digits[201] =
|
||||||
"0001020304050607080910111213141516171819"
|
"0001020304050607080910111213141516171819"
|
||||||
"2021222324252627282930313233343536373839"
|
"2021222324252627282930313233343536373839"
|
||||||
"4041424344454647484950515253545556575859"
|
"4041424344454647484950515253545556575859"
|
||||||
"6061626364656667686970717273747576777879"
|
"6061626364656667686970717273747576777879"
|
||||||
"8081828384858687888990919293949596979899";
|
"8081828384858687888990919293949596979899";
|
||||||
uint_t next = 30, rem, i;
|
uint_t next = 30, quo, i;
|
||||||
|
|
||||||
dst[31] = '\0';
|
|
||||||
|
|
||||||
while (val >= 100) {
|
while (val >= 100) {
|
||||||
rem = val / 100;
|
quo = val / 100;
|
||||||
i = (val - (rem * 100)) * 2;
|
i = (val - (quo * 100)) * 2;
|
||||||
val = rem;
|
val = quo;
|
||||||
dst[next] = digits[i + 1];
|
dst[next] = digits[i + 1];
|
||||||
dst[--next] = digits[i];
|
dst[--next] = digits[i];
|
||||||
--next;
|
--next;
|
||||||
|
|
Loading…
Add table
Reference in a new issue