summaryrefslogtreecommitdiffhomepage
path: root/ir/obstack
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2010-10-08 15:36:50 +0200
committerMatthias Braun <matze@braunis.de>2010-10-08 15:36:50 +0200
commit1430b7d9727c905e51af70137ddd71c85c52e5ba (patch)
tree07cfff395ecb6ca1a3fa5121171b63a8078f3aed /ir/obstack
parent1904be1476fab95c3f09c622f9718bb44b6aae6c (diff)
win32 version of obstack_printf
[r28058]
Diffstat (limited to 'ir/obstack')
-rw-r--r--ir/obstack/obstack_printf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ir/obstack/obstack_printf.c b/ir/obstack/obstack_printf.c
index eb5b86e..c1d754f 100644
--- a/ir/obstack/obstack_printf.c
+++ b/ir/obstack/obstack_printf.c
@@ -5,9 +5,15 @@
#include "obstack.h"
#ifdef _WIN32
-#define vsnprintf _vsnprintf
-#endif
-
+/* win32/C89 has no va_copy function... so we have to use the stupid fixed-length version */
+int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap)
+{
+ char buf[16384];
+ int len = _vsnprintf(buf, sizeof(buf), fmt, ap);
+ obstack_grow(obst, buf, len);
+ return len;
+}
+#else
int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap)
{
char buf[128];
@@ -46,6 +52,7 @@ int obstack_vprintf(struct obstack *obst, const char *fmt, va_list ap)
return len;
}
+#endif
int obstack_printf(struct obstack *obst, const char *fmt, ...)
{