fc_version() return combined integer version

pull/56/merge
YuQing 2026-06-24 08:21:27 +08:00
parent 0ebccb5bf0
commit 724b008b0e
3 changed files with 16 additions and 2 deletions

View File

@ -372,6 +372,16 @@ typedef void* (*MallocFunc)(size_t size);
#define FC_SET_CHAIN_TAIL_NEXT(chain, type, ptr) \ #define FC_SET_CHAIN_TAIL_NEXT(chain, type, ptr) \
((type *)(chain).tail)->next = ptr ((type *)(chain).tail)->next = ptr
#define FC_VERSION_TO_INT(major, minor, patch) \
(major * 1000 * 1000 + minor * 1000 + patch)
#define FC_VERSION_TO_INT1(version) \
FC_VERSION_TO_INT((version).major, \
(version).minor, (version).patch)
#define FC_COMPARE_INT_VERSIONS_TO_OPERATOR_STR(v1, v2) \
(v1 < v2 ? "<" : (v1 == v2 ? "==" : ">"))
#ifdef WIN32 #ifdef WIN32
#define strcasecmp _stricmp #define strcasecmp _stricmp
#endif #endif

View File

@ -15,9 +15,10 @@
#include "fc_version.h" #include "fc_version.h"
void fc_version(Version *version) int fc_version(Version *version)
{ {
version->major = FC_MAJOR_VERSION; version->major = FC_MAJOR_VERSION;
version->minor = FC_MINOR_VERSION; version->minor = FC_MINOR_VERSION;
version->patch = FC_PATCH_VERSION; version->patch = FC_PATCH_VERSION;
return FC_VERSION_TO_INT1(*version);
} }

View File

@ -24,11 +24,14 @@
#define FC_MINOR_VERSION 0 #define FC_MINOR_VERSION 0
#define FC_PATCH_VERSION 85 #define FC_PATCH_VERSION 85
#define FC_VERSION_INT FC_VERSION_TO_INT(FC_MAJOR_VERSION, \
FC_MINOR_VERSION, FC_PATCH_VERSION)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void fc_version(Version *version); int fc_version(Version *version);
#ifdef __cplusplus #ifdef __cplusplus
} }