summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-09-15 09:51:11 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-09-15 09:51:11 +0200
commit0d463906c72e07d7c0679f1f1843dae9b2e63715 (patch)
tree73a650c0080194448f554cdc8140765000610f46
parentc411c1f2acb1057ee705a8ff163ad0892d5e21cf (diff)
Drop use of asprintf (not supported on win32)
-rw-r--r--src/versionstr.cc10
1 files 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;
}