mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
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`.
This commit is contained in:
parent
e04dc5105b
commit
d07999ddff
@ -15,7 +15,7 @@ namespace Catch {
|
|||||||
Version( unsigned int _majorVersion,
|
Version( unsigned int _majorVersion,
|
||||||
unsigned int _minorVersion,
|
unsigned int _minorVersion,
|
||||||
unsigned int _patchNumber,
|
unsigned int _patchNumber,
|
||||||
std::string const& _branchName,
|
char const * const _branchName,
|
||||||
unsigned int _buildNumber );
|
unsigned int _buildNumber );
|
||||||
|
|
||||||
unsigned int const majorVersion;
|
unsigned int const majorVersion;
|
||||||
@ -23,7 +23,7 @@ namespace Catch {
|
|||||||
unsigned int const patchNumber;
|
unsigned int const patchNumber;
|
||||||
|
|
||||||
// buildNumber is only used if branchName is not null
|
// buildNumber is only used if branchName is not null
|
||||||
std::string const branchName;
|
char const * const branchName;
|
||||||
unsigned int const buildNumber;
|
unsigned int const buildNumber;
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& os, Version const& version );
|
friend std::ostream& operator << ( std::ostream& os, Version const& version );
|
||||||
|
@ -16,7 +16,7 @@ namespace Catch {
|
|||||||
( unsigned int _majorVersion,
|
( unsigned int _majorVersion,
|
||||||
unsigned int _minorVersion,
|
unsigned int _minorVersion,
|
||||||
unsigned int _patchNumber,
|
unsigned int _patchNumber,
|
||||||
std::string const& _branchName,
|
char const * const _branchName,
|
||||||
unsigned int _buildNumber )
|
unsigned int _buildNumber )
|
||||||
: majorVersion( _majorVersion ),
|
: majorVersion( _majorVersion ),
|
||||||
minorVersion( _minorVersion ),
|
minorVersion( _minorVersion ),
|
||||||
@ -29,10 +29,10 @@ namespace Catch {
|
|||||||
os << version.majorVersion << '.'
|
os << version.majorVersion << '.'
|
||||||
<< version.minorVersion << '.'
|
<< version.minorVersion << '.'
|
||||||
<< version.patchNumber;
|
<< version.patchNumber;
|
||||||
|
// branchName is never null -> 0th char is \0 if it is empty
|
||||||
if( !version.branchName.empty() ) {
|
if (version.branchName[0]) {
|
||||||
os << '-' << version.branchName
|
os << '-' << version.branchName
|
||||||
<< '.' << version.buildNumber;
|
<< '.' << version.buildNumber;
|
||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user