From 0d463906c72e07d7c0679f1f1843dae9b2e63715 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 15 Sep 2013 09:51:11 +0200 Subject: Drop use of asprintf (not supported on win32) --- src/versionstr.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/versionstr.cc b/src/versionstr.cc index 3ef09e2..e90caa8 100644 --- a/src/versionstr.cc +++ b/src/versionstr.cc @@ -78,12 +78,10 @@ void VersionStr::set(std::string v) throw(const char *) VersionStr::operator std::string() const { std::string v; - char *buf; - size_t sz; - if(patch()) sz = asprintf(&buf, "%d.%d.%d", major(), minor(), patch()); - else sz = asprintf(&buf, "%d.%d", major(), minor()); - if(sz) v = buf; - free(buf); + char buf[64]; + if(patch()) sprintf(buf, "%d.%d.%d", major(), minor(), patch()); + else sprintf(buf, "%d.%d", major(), minor()); + v = buf; return v; } -- cgit v1.2.3