forked from agroal/pgagroal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[agroal#291] Make the version number comparable
Three new constants are introduced here: - PGAGROAL_MAJOR_VERSION (number) - PGAGROAL_MINOR_VERSION (number) - PGAGROAL_PATCH_VERSION (number) - PGAGROAL_VERSION (string) that represent, as integer literals and string composition, the parts of the version number. The values are copied from the variables in the `CmakeLists.txt` file that creates the building flow, so changing the values in a single place changes and propagates the changes all over the source code. A few utility functions have been introduced to compose the three constant into a unique number that can be used to compare the version currently running, so that features and/or message can be targeted as conditionals. Introduced functions are: - pgagroal_version_as_number() returns an unique sortable version number. For example, version 1.5.0 is returned as 15000, version 1.6.2 as 16002, and so on; - pgagroal_version_number() returns the currently running version number, that is invokes pgagroal_version_as_number() with the predefined constants. The `pgagroal_version_as_number()` accepts individual values, while `pgagroal_version_number()` provides the currently running version number. The idea is that, thanks to both the functions, it is possible to check for a feature that depends on a version in a way like the following one: if (pgagroal_version_numer() >= pgagroal_version_as_number(2,1,0)) // version is greater than 2.1.0 ! The utility function `pgagroal_version_ge()` does exactly the above: it accepts the three parts of a version number and checks if the currently running version is greater or equal (hence, 'ge') of the specified triplet, so that the above piece of code becomes: if (pgagroal_version_ge(2,1,0)) // version greater or equal 2.1.0 Close agroal#292 See agroal#253, agroal#289, agroal#290, agroal#293
- Loading branch information
Showing
7 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters