diff options
Diffstat (limited to 'src/versionstr.cc')
-rw-r--r-- | src/versionstr.cc | 10 |
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; } |