aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-09-17 13:06:11 +0000
committerlloyd <[email protected]>2012-09-17 13:06:11 +0000
commitccaf5fc3fbc694fdf45ba74526476c4f94c33875 (patch)
tree7416a442f0082224767d35f009b87864f756c3ef /src/utils
parent56c1d79d07dfab8b1e8503de7a594bccb3fbeef2 (diff)
Make the result of version_string a compile time constant string, so
we can find the complete value by running strings on a binary file.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/version.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/utils/version.cpp b/src/utils/version.cpp
index acc8bee61..d886587fd 100644
--- a/src/utils/version.cpp
+++ b/src/utils/version.cpp
@@ -22,21 +22,23 @@ namespace Botan {
*/
std::string version_string()
{
- std::ostringstream out;
-
- out << "Botan " << version_major() << "."
- << version_minor() << "."
- << version_patch() << " (";
-
- if(BOTAN_VERSION_DATESTAMP == 0)
- out << "unreleased version";
- else
- out << "released " << version_datestamp();
-
- out << ", revision " << BOTAN_VERSION_VC_REVISION;
- out << ", distribution " << BOTAN_DISTRIBUTION_INFO << ")";
-
- return out.str();
+#define QUOTE(name) #name
+#define STR(macro) QUOTE(macro)
+
+ return "Botan " STR(BOTAN_VERSION_MAJOR) "."
+ STR(BOTAN_VERSION_MINOR) "."
+ STR(BOTAN_VERSION_PATCH) " ("
+
+#if (BOTAN_VERSION_DATESTAMP == 0)
+ "unreleased version"
+#else
+ "released " STR(BOTAN_VERSION_DATESTAMP)
+#endif
+ ", revision " BOTAN_VERSION_VC_REVISION
+ ", distribution " BOTAN_DISTRIBUTION_INFO ")";
+
+#undef STR
+#undef QUOTE
}
u32bit version_datestamp() { return BOTAN_VERSION_DATESTAMP; }