]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - utf8lib.c
major overhaul for thread-safety - many global variables and static
[xonotic/darkplaces.git] / utf8lib.c
index b726e220d9768ca01d82b973aba0d5d464fecdd2..8994bd7a00a697e124779b86318919aea0d5aaf9 100644 (file)
--- a/utf8lib.c
+++ b/utf8lib.c
@@ -596,15 +596,14 @@ int u8_fromchar(Uchar w, char *to, size_t maxlen)
  * @param l         The number of bytes without the terminating null.
  * @return          A statically allocated buffer containing the character's utf8 representation, or NULL if it fails.
  */
-char *u8_encodech(Uchar ch, size_t *l)
+char *u8_encodech(Uchar ch, size_t *l, char *buf16)
 {
-       static char buf[16];
        size_t len;
-       len = u8_fromchar(ch, buf, sizeof(buf));
+       len = u8_fromchar(ch, buf16, 16);
        if (len > 0)
        {
                if (l) *l = len;
-               return buf;
+               return buf16;
        }
        return NULL;
 }