make api versioning actually work
This commit is contained in:
parent
147f372a9b
commit
53ff1074ef
5 changed files with 8 additions and 25 deletions
4
mod.h
4
mod.h
|
@ -6,7 +6,7 @@
|
|||
|
||||
static const semver API_VERSION = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
.minor = 2,
|
||||
.patch = 0,
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@ static const uint8_t MFERR_APIVER = 1;
|
|||
semver version(void);
|
||||
const char *name(void);
|
||||
|
||||
uint8_t init(char **config);
|
||||
uint8_t init(semver api_ver, char **config);
|
||||
const char *get(void);
|
||||
|
||||
#endif // _MODFETCH_MOD_H
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "mod.h"
|
||||
#include "semver.h"
|
||||
#include <ctype.h>
|
||||
#include <dlfcn.h>
|
||||
|
@ -267,10 +268,10 @@ int main(int argc, char *argv[]) {
|
|||
semver (*version)(void) = dlsym(handle, "version");
|
||||
const char *(*name)(void) = dlsym(handle, "name");
|
||||
const char *(*get)(void) = dlsym(handle, "get");
|
||||
void (*init)(char**) = dlsym(handle, "init");
|
||||
void (*init)(semver, char**) = dlsym(handle, "init");
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
init(current_module.config);
|
||||
init(API_VERSION, current_module.config);
|
||||
|
||||
(void)name;
|
||||
(void)version;
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const semver api_ver = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
.patch = 0,
|
||||
};
|
||||
|
||||
static const semver _version = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
|
@ -23,7 +17,7 @@ static const semver _version = {
|
|||
semver version(void) { return _version; }
|
||||
const char *name(void) { return "desktop"; }
|
||||
|
||||
uint8_t init(char **config) {
|
||||
uint8_t init(semver api_ver, char **config) {
|
||||
if (!sveq(api_ver, API_VERSION)) {
|
||||
return MFERR_APIVER;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static const semver api_ver = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
.patch = 0,
|
||||
};
|
||||
|
||||
static const semver _version = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
|
@ -25,7 +19,7 @@ static const semver _version = {
|
|||
semver version(void) { return _version; }
|
||||
const char *name(void) { return "os"; }
|
||||
|
||||
uint8_t init(char **config) {
|
||||
uint8_t init(semver api_ver, char **config) {
|
||||
if (!sveq(api_ver, API_VERSION)) {
|
||||
return MFERR_APIVER;
|
||||
}
|
||||
|
|
|
@ -12,12 +12,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static const semver api_ver = {
|
||||
.major = 0,
|
||||
.minor = 1,
|
||||
.patch = 0,
|
||||
};
|
||||
|
||||
static const semver _version = {
|
||||
.major = 1,
|
||||
.minor = 0,
|
||||
|
@ -31,7 +25,7 @@ static size_t length = 8;
|
|||
static char *sep_char = "-";
|
||||
static size_t sep_char_length = 1;
|
||||
|
||||
uint8_t init(char **config) {
|
||||
uint8_t init(semver api_ver, char **config) {
|
||||
if (!sveq(api_ver, API_VERSION)) {
|
||||
return MFERR_APIVER;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue