#include <stdio.h>
#include <string.h>
#include <stdarg.h>
-#if defined(WIN32) || defined(__WIN32__)
+#if defined(__WATCOMC__) || defined(_WIN32) || defined(__DJGPP__)
#include <malloc.h>
#else
#include <alloca.h>
#endif
#include "drawtext.h"
-#include "drawtext_impl.h"
+#include "dtximpl.h"
void dtx_position(float x, float y)
{
}
}
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__WATCOMC__)
#define vsnprintf _vsnprintf
#endif
void dtx_printf(const char *fmt, ...)
{
va_list ap;
- int buf_size;
- char *buf, tmp;
+ static char buf[1024];
if(!dtx_font) {
return;
}
va_start(ap, fmt);
- buf_size = vsnprintf(&tmp, 0, fmt, ap);
- va_end(ap);
-
- if(buf_size == -1) {
- buf_size = 512;
- }
-
- buf = alloca(buf_size + 1);
- va_start(ap, fmt);
- vsnprintf(buf, buf_size + 1, fmt, ap);
+ vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
dtx_string(buf);