Version struct now uses char* for holding branch name
Since the info is constant, and the only use is to write it out during
runtime, there is no need for `std::string`.
diff --git a/include/internal/catch_version.h b/include/internal/catch_version.h
index 09032d6..9f6bc28 100644
--- a/include/internal/catch_version.h
+++ b/include/internal/catch_version.h
@@ -15,7 +15,7 @@
Version( unsigned int _majorVersion,
unsigned int _minorVersion,
unsigned int _patchNumber,
- std::string const& _branchName,
+ char const * const _branchName,
unsigned int _buildNumber );
unsigned int const majorVersion;
@@ -23,7 +23,7 @@
unsigned int const patchNumber;
// buildNumber is only used if branchName is not null
- std::string const branchName;
+ char const * const branchName;
unsigned int const buildNumber;
friend std::ostream& operator << ( std::ostream& os, Version const& version );
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index 2af8634..4ce9064 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -16,7 +16,7 @@
( unsigned int _majorVersion,
unsigned int _minorVersion,
unsigned int _patchNumber,
- std::string const& _branchName,
+ char const * const _branchName,
unsigned int _buildNumber )
: majorVersion( _majorVersion ),
minorVersion( _minorVersion ),
@@ -29,10 +29,10 @@
os << version.majorVersion << '.'
<< version.minorVersion << '.'
<< version.patchNumber;
-
- if( !version.branchName.empty() ) {
- os << '-' << version.branchName
- << '.' << version.buildNumber;
+ // branchName is never null -> 0th char is \0 if it is empty
+ if (version.branchName[0]) {
+ os << '-' << version.branchName
+ << '.' << version.buildNumber;
}
return os;
}