diff --git a/src/util/base36.c b/src/util/base36.c index 65c9db812..7edb46027 100644 --- a/src/util/base36.c +++ b/src/util/base36.c @@ -54,22 +54,14 @@ int atoi36(const char *str) const char *itoab(int i, int base) { - const int maxlen = 20; - static char **as = NULL; // FIXME: static return value + static char sstr[80]; char *s, *dst; static int index = 0; /* STATIC_XCALL: used across calls */ int neg = 0; - if (!as) { - int j; - char *x = (char *)calloc(sizeof(char), maxlen * 4); /* STATIC_LEAK: malloc in static variable */ - as = (char **)calloc(sizeof(char *), 4); - for (j = 0; j != 4; ++j) - as[j] = x + j * maxlen; - } - s = as[index]; + s = sstr + (index * 20); index = (index + 1) & 3; /* quick for % 4 */ - dst = s + maxlen - 1; + dst = s + 19; (*dst--) = 0; if (i != 0) { if (i < 0) {