Commit 81d0b32f authored by Nicolas Denoyelle's avatar Nicolas Denoyelle

move version query to a function to avoid need to initialize aml library to check version.

parent d2195303
Pipeline #6727 failed with stage
in 18 minutes and 42 seconds
......@@ -33,14 +33,14 @@
#include <aml/utils/vector.h>
/*
* If AML_ABI_VERSION != aml_major_version,
* If AML_ABI_VERSION != aml_get_major_version(),
* the header is not the same version as linked library.
*/
#define AML_ABI_VERSION (0)
extern const char* aml_version_string;
extern int aml_major_version;
extern int aml_minor_version;
extern int aml_patch_version;
int aml_get_major_version();
int aml_get_minor_version();
int aml_get_patch_version();
/*******************************************************************************
* General functions:
......
......@@ -17,6 +17,32 @@ int aml_major_version = -1;
int aml_minor_version = -1;
int aml_patch_version = -1;
int aml_get_major_version(){
if(aml_major_version < 0){
return atoi(strtok(VERSION, "."));
}
return aml_major_version;
}
int aml_get_minor_version(){
if(aml_major_version < 0){
char * version = VERSION;
strtok(version, ".");
return atoi(strtok(version, "."));
}
return aml_minor_version;
}
int aml_get_patch_version(){
if(aml_major_version < 0){
char * version = VERSION;
strtok(version, ".");
strtok(version, ".");
return atoi(strtok(version, "."));
}
return aml_minor_version;
}
int aml_init(int *argc, char **argv[])
{
char * version = VERSION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment