summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-10-04 00:56:25 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-10-04 00:56:25 +0200
commit69401cf03ede9563b48904228b0d8801defd0c04 (patch)
tree1b9789d476d3a26e60bc16bc53a99aea0c648505
parent04dbe446e821ccabfb765d8a4381994dfd9916c2 (diff)
It's not because Microsoft is stupid by not having vasprintf that we need to be stupid too.
-rw-r--r--src/BString.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/BString.cc b/src/BString.cc
index 61abb8c..0b4b428 100644
--- a/src/BString.cc
+++ b/src/BString.cc
@@ -4,19 +4,19 @@
#include "BString.h"
void Balau::String::set(const char * fmt, va_list ap) {
- char * t;
unsigned int l;
#ifdef _WIN32
// Microsoft is stupid.
char tt[65536];
l = _vsnprintf(tt, sizeof(tt) - 1, fmt, ap);
tt[65535] = 0;
- t = ::strdup(tt);
+ assign(tt, l);
#else
+ char * t;
l = vasprintf(&t, fmt, ap);
-#endif
assign(t, l);
free(t);
+#endif
}
int Balau::String::strchrcnt(char c) const {