rnd-20031203-1-src
[rocksndiamonds.git] / src / libgame / misc.c
index cb06ff4697ac1488b8c07705a41734a5589f0985..66d1064902c4c947e216a8c59566411e3d981ea3 100644 (file)
@@ -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                                                         */