Special case version 0.0.0 which is equal to any version
Former-commit-id: 869d037490b6905674f75a8552898aed72148558
This commit is contained in:
parent
ebe0b918bc
commit
682d16b7d3
@ -1679,6 +1679,11 @@ SymVer parseVersion(const char *version)
|
|||||||
VersionCompareResult compareVersion(SymVer *pver)
|
VersionCompareResult compareVersion(SymVer *pver)
|
||||||
{
|
{
|
||||||
SymVer symVerThis = parseVersion(KEYDB_REAL_VERSION);
|
SymVer symVerThis = parseVersion(KEYDB_REAL_VERSION);
|
||||||
|
// Special case, 0.0.0 is equal to any version
|
||||||
|
if ((symVerThis.major == 0 && symVerThis.minor == 0 && symVerThis.build == 0)
|
||||||
|
|| (pver->major == 0 && pver->minor == 0 && pver->build == 0))
|
||||||
|
return VersionCompareResult::EqualVersion;
|
||||||
|
|
||||||
for (int iver = 0; iver < 3; ++iver)
|
for (int iver = 0; iver < 3; ++iver)
|
||||||
{
|
{
|
||||||
long verThis, verOther;
|
long verThis, verOther;
|
||||||
@ -1699,7 +1704,7 @@ VersionCompareResult compareVersion(SymVer *pver)
|
|||||||
if (verThis > verOther)
|
if (verThis > verOther)
|
||||||
return VersionCompareResult::OlderVersion;
|
return VersionCompareResult::OlderVersion;
|
||||||
}
|
}
|
||||||
return VersionCompareResult::EqualVerison;
|
return VersionCompareResult::EqualVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is used in order to track clients using the biggest amount
|
/* This function is used in order to track clients using the biggest amount
|
||||||
@ -5457,7 +5462,7 @@ int main(int argc, char **argv) {
|
|||||||
SymVer version;
|
SymVer version;
|
||||||
version = parseVersion(KEYDB_REAL_VERSION);
|
version = parseVersion(KEYDB_REAL_VERSION);
|
||||||
serverAssert(version.major >= 0 && version.minor >= 0 && version.build >= 0);
|
serverAssert(version.major >= 0 && version.minor >= 0 && version.build >= 0);
|
||||||
serverAssert(compareVersion(&version) == VersionCompareResult::EqualVerison);
|
serverAssert(compareVersion(&version) == VersionCompareResult::EqualVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_MEMKIND
|
#ifdef USE_MEMKIND
|
||||||
|
@ -3,7 +3,7 @@ extern const char *KEYDB_SET_VERSION; // Unlike real version, this can be over
|
|||||||
|
|
||||||
enum VersionCompareResult
|
enum VersionCompareResult
|
||||||
{
|
{
|
||||||
EqualVerison,
|
EqualVersion,
|
||||||
OlderVersion,
|
OlderVersion,
|
||||||
NewerVersion,
|
NewerVersion,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user