X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=66d1064902c4c947e216a8c59566411e3d981ea3;hb=4bb90da7a98b741b4576099be6b89d324c8a80de;hp=cb06ff4697ac1488b8c07705a41734a5589f0985;hpb=b645a25fff77d62a36c744fa4047a3c0e5929341;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index cb06ff46..66d10649 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -82,6 +82,27 @@ char *int2str(int number, int size) } } +/* something similar to "int2str()" above, but allocates its own memory + and has a different interface; we cannot use "itoa()", because this + seems to be already defined when cross-compiling to the win32 target */ + +char *i_to_a(unsigned int i) +{ + static char *a = NULL; + + if (a != NULL) + free(a); + + if (i > 2147483647) /* yes, this is a kludge */ + i = 2147483647; + + a = checked_malloc(10 + 1); + + sprintf(a, "%d", i); + + return a; +} + /* ------------------------------------------------------------------------- */ /* counter functions */