Add a more convenient method for compile/run-time version checks.
This commit is contained in:
parent
fed4e562ee
commit
2cd09fd525
@ -1,4 +1,5 @@
|
||||
dc_version
|
||||
dc_version_check
|
||||
|
||||
dc_buffer_new
|
||||
dc_buffer_free
|
||||
|
||||
@ -33,3 +33,9 @@ dc_version (dc_version_t *version)
|
||||
|
||||
return DC_VERSION;
|
||||
}
|
||||
|
||||
int
|
||||
dc_version_check (unsigned int major, unsigned int minor, unsigned int micro)
|
||||
{
|
||||
return DC_VERSION_CHECK (major,minor,micro);
|
||||
}
|
||||
|
||||
@ -32,6 +32,12 @@ extern "C" {
|
||||
#define DC_VERSION_MICRO @DC_VERSION_MICRO@
|
||||
#define DC_VERSION_EXTRA "@DC_VERSION_EXTRA@"
|
||||
|
||||
#define DC_VERSION_CHECK(major,minor,micro) \
|
||||
(DC_VERSION_MAJOR > (major) || \
|
||||
(DC_VERSION_MAJOR == (major) && DC_VERSION_MINOR > (minor)) || \
|
||||
(DC_VERSION_MAJOR == (major) && DC_VERSION_MINOR == (minor) && \
|
||||
DC_VERSION_MICRO >= (micro)))
|
||||
|
||||
typedef struct dc_version_t {
|
||||
unsigned int major;
|
||||
unsigned int minor;
|
||||
@ -42,6 +48,9 @@ typedef struct dc_version_t {
|
||||
const char *
|
||||
dc_version (dc_version_t *version);
|
||||
|
||||
int
|
||||
dc_version_check (unsigned int major, unsigned int minor, unsigned int micro);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user