mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 16:55:10 +00:00
[ADD/MOD] CFLAGS/LDFLAGS and version checks
This commit is contained in:
parent
ad7f4f20e1
commit
0ec028d458
7 changed files with 222 additions and 80 deletions
10
Makefile
10
Makefile
|
|
@ -19,8 +19,8 @@ PREFIX ?=/usr/local
|
||||||
|
|
||||||
AYAS=ayaya
|
AYAS=ayaya
|
||||||
ETC=etc
|
ETC=etc
|
||||||
CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" -O2 -g -Wall -Werror
|
FCFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" $(CFLAGS)
|
||||||
LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -O2 -g
|
FLDFLAGS=-L $(CYTO_LIB) -lCytoplasm $(LDFLAGS)
|
||||||
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
|
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
|
||||||
# ============================ Compilation =================================
|
# ============================ Compilation =================================
|
||||||
SRC_FILES:=$(shell find $(SOURCE) -name '*.c') $(shell find $(ETC)/media -name '*.png')
|
SRC_FILES:=$(shell find $(SOURCE) -name '*.c') $(shell find $(ETC)/media -name '*.png')
|
||||||
|
|
@ -32,7 +32,7 @@ AYA_FILES:=${subst $(INCLUDES)/,$(AYAS)/,$(patsubst %.h, %.html, $(CPP_FILES))}
|
||||||
all: utils binary
|
all: utils binary
|
||||||
|
|
||||||
binary: $(OBJ_FILES)
|
binary: $(OBJ_FILES)
|
||||||
$(CC) $(LDFLAGS) $(OBJ_FILES) -o $(BINARY)
|
$(CC) $(FLDFLAGS) $(OBJ_FILES) -o $(BINARY)
|
||||||
tags: $(SRC_FILES)
|
tags: $(SRC_FILES)
|
||||||
@ctags --recurse $(SOURCE)/
|
@ctags --recurse $(SOURCE)/
|
||||||
|
|
||||||
|
|
@ -45,10 +45,10 @@ $(OBJECT)/%.o: $(ETC)/media/%.png
|
||||||
@base64 $< | \
|
@base64 $< | \
|
||||||
sed -e 's/^\(.*\)$$/ "\1"/' | \
|
sed -e 's/^\(.*\)$$/ "\1"/' | \
|
||||||
sed -e '$$ s/^\(.*\)$$/\1;/' >> $@.c
|
sed -e '$$ s/^\(.*\)$$/\1;/' >> $@.c
|
||||||
$(CC) -c $(CFLAGS) $@.c -o $@
|
$(CC) -c $(FCFLAGS) $@.c -o $@
|
||||||
$(OBJECT)/%.o: $(SOURCE)/%.c
|
$(OBJECT)/%.o: $(SOURCE)/%.c
|
||||||
@mkdir -p $(shell dirname "$@")
|
@mkdir -p $(shell dirname "$@")
|
||||||
$(CC) -c $(CFLAGS) $< -o $@
|
$(CC) -c $(FCFLAGS) $< -o $@
|
||||||
|
|
||||||
utils:
|
utils:
|
||||||
(cd tools && make)
|
(cd tools && make)
|
||||||
|
|
|
||||||
196
build.c
196
build.c
|
|
@ -203,6 +203,8 @@ typedef struct buildinfo {
|
||||||
char *inc;
|
char *inc;
|
||||||
char *obj;
|
char *obj;
|
||||||
|
|
||||||
|
char *cflags, *ldflags;
|
||||||
|
|
||||||
char *cc;
|
char *cc;
|
||||||
} basic;
|
} basic;
|
||||||
|
|
||||||
|
|
@ -216,52 +218,26 @@ destroy_buildinfo(buildinfo_t *info)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->basic.codename)
|
#define FreeIfExistent(v) do \
|
||||||
{
|
{ \
|
||||||
free(info->basic.codename);
|
if (v) \
|
||||||
info->basic.codename = NULL;
|
{ \
|
||||||
}
|
free(v); \
|
||||||
if (info->basic.version)
|
v = NULL; \
|
||||||
{
|
} \
|
||||||
free(info->basic.version);
|
} while (0)
|
||||||
info->basic.version = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.name)
|
|
||||||
{
|
|
||||||
free(info->basic.name);
|
|
||||||
info->basic.name = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.binary)
|
|
||||||
{
|
|
||||||
free(info->basic.binary);
|
|
||||||
info->basic.binary = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.src)
|
|
||||||
{
|
|
||||||
free(info->basic.src);
|
|
||||||
info->basic.src = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.inc)
|
|
||||||
{
|
|
||||||
free(info->basic.inc);
|
|
||||||
info->basic.inc = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.obj)
|
|
||||||
{
|
|
||||||
free(info->basic.obj);
|
|
||||||
info->basic.obj = NULL;
|
|
||||||
}
|
|
||||||
if (info->basic.cc)
|
|
||||||
{
|
|
||||||
free(info->basic.cc);
|
|
||||||
info->basic.cc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info->repo)
|
FreeIfExistent(info->basic.codename);
|
||||||
{
|
FreeIfExistent(info->basic.version);
|
||||||
free(info->repo);
|
FreeIfExistent(info->basic.ldflags);
|
||||||
info->repo = NULL;
|
FreeIfExistent(info->basic.binary);
|
||||||
}
|
FreeIfExistent(info->basic.cflags);
|
||||||
|
FreeIfExistent(info->basic.name);
|
||||||
|
FreeIfExistent(info->basic.src);
|
||||||
|
FreeIfExistent(info->basic.inc);
|
||||||
|
FreeIfExistent(info->basic.obj);
|
||||||
|
FreeIfExistent(info->basic.cc);
|
||||||
|
FreeIfExistent(info->repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|
@ -309,8 +285,10 @@ exec_code(char *program, char *argv[])
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/* We're not meant to ever be there, but TCC is stupid. */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
strchrn(char *s, char c)
|
strchrn(char *s, char c)
|
||||||
|
|
@ -358,6 +336,32 @@ mkdir_rec(char *dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static str_array_t *
|
||||||
|
split(char *dir)
|
||||||
|
{
|
||||||
|
str_array_t *ret;
|
||||||
|
char *start;
|
||||||
|
if (!dir || strlen(dir) >= PATH_MAX - 1)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = str_array_create();
|
||||||
|
for (start = dir; start; start = strchrn(start, ' '))
|
||||||
|
{
|
||||||
|
char subtmp[PATH_MAX];
|
||||||
|
char *next = strchr(start, ' ');
|
||||||
|
if (!next)
|
||||||
|
{
|
||||||
|
next = start + strlen(start);
|
||||||
|
}
|
||||||
|
memcpy(subtmp, start, next - start);
|
||||||
|
subtmp[next - start] = '\0';
|
||||||
|
|
||||||
|
str_array_add(ret, subtmp);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
static time_t
|
static time_t
|
||||||
mod_date(char *file)
|
mod_date(char *file)
|
||||||
{
|
{
|
||||||
|
|
@ -371,7 +375,7 @@ mod_date(char *file)
|
||||||
static bool
|
static bool
|
||||||
build_file(char *cSource, buildinfo_t info, bool isTool)
|
build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
{
|
{
|
||||||
char *args[16] = { 0 };
|
str_array_t *args, *cflags;
|
||||||
char *oFileName, *objPath, *oFile;
|
char *oFileName, *objPath, *oFile;
|
||||||
int ret, i = 0;
|
int ret, i = 0;
|
||||||
int srclen;
|
int srclen;
|
||||||
|
|
@ -408,30 +412,44 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i++] = Compiler(info);
|
args = str_array_create();
|
||||||
|
if (!isTool)
|
||||||
|
{
|
||||||
|
printf("\tCC %s...\n", cSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
str_array_add(args, Compiler(info));
|
||||||
if (isTool)
|
if (isTool)
|
||||||
{
|
{
|
||||||
args[i++] = "-lCytoplasm";
|
str_array_add(args, "-lCytoplasm");
|
||||||
args[i++] = "-I.";
|
str_array_add(args, "-I.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args[i++] = "-c";
|
str_array_add(args, "-c");
|
||||||
}
|
}
|
||||||
args[i++] = cSource;
|
str_array_add(args, cSource);
|
||||||
args[i++] = "-o";
|
|
||||||
args[i++] = oFileName;
|
|
||||||
|
|
||||||
args[i++] = "-I";
|
cflags = split(info.basic.cflags);
|
||||||
args[i++] = info.basic.inc;
|
for (i = 0; i < str_array_len(cflags); i++)
|
||||||
args[i++] = "-I";
|
{
|
||||||
args[i++] = info.basic.src;
|
str_array_add(args, str_array_get(cflags, i));
|
||||||
|
}
|
||||||
|
str_array_free(cflags);
|
||||||
|
|
||||||
|
str_array_add(args, "-o");
|
||||||
|
str_array_add(args, oFileName);
|
||||||
|
|
||||||
|
str_array_add(args, "-I");
|
||||||
|
str_array_add(args, info.basic.inc);
|
||||||
|
str_array_add(args, "-I");
|
||||||
|
str_array_add(args, info.basic.src);
|
||||||
|
|
||||||
{
|
{
|
||||||
char *pre = string_cat("\"", info.basic.version);
|
char *pre = string_cat("\"", info.basic.version);
|
||||||
char *pos = string_cat(pre, "\"");
|
char *pos = string_cat(pre, "\"");
|
||||||
vers = string_cat("-DVERSION=", pos);
|
vers = string_cat("-DVERSION=", pos);
|
||||||
args[i++] = vers;
|
str_array_add(args, vers);
|
||||||
|
|
||||||
free(pos);
|
free(pos);
|
||||||
free(pre);
|
free(pre);
|
||||||
|
|
@ -440,7 +458,7 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
char *pre = string_cat("\"", info.basic.name);
|
char *pre = string_cat("\"", info.basic.name);
|
||||||
char *pos = string_cat(pre, "\"");
|
char *pos = string_cat(pre, "\"");
|
||||||
name = string_cat("-DNAME=", pos);
|
name = string_cat("-DNAME=", pos);
|
||||||
args[i++] = name;
|
str_array_add(args, name);
|
||||||
|
|
||||||
free(pos);
|
free(pos);
|
||||||
free(pre);
|
free(pre);
|
||||||
|
|
@ -449,7 +467,7 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
char *pre = string_cat("\"", info.basic.codename);
|
char *pre = string_cat("\"", info.basic.codename);
|
||||||
char *pos = string_cat(pre, "\"");
|
char *pos = string_cat(pre, "\"");
|
||||||
code = string_cat("-DCODE=", pos);
|
code = string_cat("-DCODE=", pos);
|
||||||
args[i++] = code;
|
str_array_add(args, code);
|
||||||
|
|
||||||
free(pos);
|
free(pos);
|
||||||
free(pre);
|
free(pre);
|
||||||
|
|
@ -458,15 +476,17 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
char *pre = string_cat("\"", info.repo);
|
char *pre = string_cat("\"", info.repo);
|
||||||
char *pos = string_cat(pre, "\"");
|
char *pos = string_cat(pre, "\"");
|
||||||
repo = string_cat("-DREPOSITORY=", pos);
|
repo = string_cat("-DREPOSITORY=", pos);
|
||||||
args[i++] = repo;
|
str_array_add(args, repo);
|
||||||
|
|
||||||
free(pos);
|
free(pos);
|
||||||
free(pre);
|
free(pre);
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i++] = NULL;
|
str_array_add(args, NULL);
|
||||||
|
|
||||||
ret = exec_code(Compiler(info), args);
|
ret = exec_code(Compiler(info), args->values);
|
||||||
|
|
||||||
|
str_array_free(args);
|
||||||
free(objPath);
|
free(objPath);
|
||||||
free(oFileName);
|
free(oFileName);
|
||||||
free(oFile);
|
free(oFile);
|
||||||
|
|
@ -479,7 +499,7 @@ build_file(char *cSource, buildinfo_t info, bool isTool)
|
||||||
static bool
|
static bool
|
||||||
finalise_file(str_array_t *arr, buildinfo_t info)
|
finalise_file(str_array_t *arr, buildinfo_t info)
|
||||||
{
|
{
|
||||||
str_array_t *flags;
|
str_array_t *flags, *ldflags;
|
||||||
size_t i;
|
size_t i;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
if (!arr)
|
if (!arr)
|
||||||
|
|
@ -490,6 +510,13 @@ finalise_file(str_array_t *arr, buildinfo_t info)
|
||||||
flags = str_array_create();
|
flags = str_array_create();
|
||||||
str_array_add(flags, Compiler(info));
|
str_array_add(flags, Compiler(info));
|
||||||
|
|
||||||
|
ldflags = split(info.basic.cflags);
|
||||||
|
for (i = 0; i < str_array_len(ldflags); i++)
|
||||||
|
{
|
||||||
|
str_array_add(flags, str_array_get(ldflags, i));
|
||||||
|
}
|
||||||
|
str_array_free(ldflags);
|
||||||
|
|
||||||
str_array_add(flags, "-lCytoplasm");
|
str_array_add(flags, "-lCytoplasm");
|
||||||
|
|
||||||
for (i = 0; i < str_array_len(arr); i++)
|
for (i = 0; i < str_array_len(arr); i++)
|
||||||
|
|
@ -709,6 +736,9 @@ main_build(int argc, char *argv[])
|
||||||
If("VERSION", basic.version, "Version");
|
If("VERSION", basic.version, "Version");
|
||||||
If("BINARY", basic.binary, "Binary name");
|
If("BINARY", basic.binary, "Binary name");
|
||||||
|
|
||||||
|
If("CFLAGS", basic.cflags, "C compiler arguments");
|
||||||
|
If("LDFLAGS", basic.ldflags, "Linker arguments");
|
||||||
|
|
||||||
If("INCLUDES", basic.inc, "Include path");
|
If("INCLUDES", basic.inc, "Include path");
|
||||||
If("SOURCE", basic.src, "Source path");
|
If("SOURCE", basic.src, "Source path");
|
||||||
If("OBJECT", basic.obj, "Object path");
|
If("OBJECT", basic.obj, "Object path");
|
||||||
|
|
@ -731,6 +761,20 @@ main_build(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
info.repo = trim_nl(info.repo);
|
info.repo = trim_nl(info.repo);
|
||||||
|
|
||||||
|
if (argc >= 2 && !strcmp(argv[1], "clean"))
|
||||||
|
{
|
||||||
|
char *args[8];
|
||||||
|
size_t i;
|
||||||
|
unlink(info.basic.binary);
|
||||||
|
|
||||||
|
args[i++] = "rm";
|
||||||
|
args[i++] = "-r";
|
||||||
|
args[i++] = info.basic.obj;
|
||||||
|
args[i++] = NULL;
|
||||||
|
exec_code(args[0], args);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Step 3: Build all utilities. */
|
/* Step 3: Build all utilities. */
|
||||||
sources = collect_sources("tools", true, ".c");
|
sources = collect_sources("tools", true, ".c");
|
||||||
|
|
@ -771,7 +815,6 @@ main_build(int argc, char *argv[])
|
||||||
for (i = 0; i < str_array_len(sources); i++)
|
for (i = 0; i < str_array_len(sources); i++)
|
||||||
{
|
{
|
||||||
char *file = str_array_get(sources, i);
|
char *file = str_array_get(sources, i);
|
||||||
printf("\tCC %s...\n", file);
|
|
||||||
if (!build_file(file, info, false))
|
if (!build_file(file, info, false))
|
||||||
{
|
{
|
||||||
str_array_free(sources);
|
str_array_free(sources);
|
||||||
|
|
@ -785,10 +828,8 @@ main_build(int argc, char *argv[])
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
str_array_free(sources);
|
str_array_free(sources);
|
||||||
/* Step 6: Build every Ayadoc */
|
/* TODO: Step 6: Build every Ayadoc */
|
||||||
|
end:
|
||||||
/* Step 7: Good! */
|
|
||||||
|
|
||||||
destroy_buildinfo(&info);
|
destroy_buildinfo(&info);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
fail:
|
fail:
|
||||||
|
|
@ -802,8 +843,21 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* TODO: Multiple flags(build/install/ayadoc/...) */
|
/* TODO: Multiple flags(build/install/ayadoc/...) */
|
||||||
|
if ((argc - 1) < 1)
|
||||||
|
{
|
||||||
|
/* No arguments, let's just build. */
|
||||||
return main_build(argc, argv);
|
return main_build(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(argv[1], "build") ||
|
||||||
|
!strcmp(argv[1], "clean"))
|
||||||
|
{
|
||||||
|
return main_build(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s: unknown verb: %s\n", argv[0], argv[1]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,10 @@ Main(Array *args, HashMap *env)
|
||||||
conf.maxConnections = conf.threads << 2;
|
conf.maxConnections = conf.threads << 2;
|
||||||
conf.handlerArgs = ParseeInitData(jabber);
|
conf.handlerArgs = ParseeInitData(jabber);
|
||||||
conf.handler = ParseeRequest;
|
conf.handler = ParseeRequest;
|
||||||
|
if (!conf.handlerArgs)
|
||||||
|
{
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
Log(LOG_DEBUG, "Verbosity level: %d", verbose);
|
Log(LOG_DEBUG, "Verbosity level: %d", verbose);
|
||||||
((ParseeData *) conf.handlerArgs)->verbosity = verbose;
|
((ParseeData *) conf.handlerArgs)->verbosity = verbose;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
ParseeData *
|
ParseeData *
|
||||||
ParseeInitData(XMPPComponent *comp)
|
ParseeInitData(XMPPComponent *comp)
|
||||||
{
|
{
|
||||||
|
char *version;
|
||||||
ParseeData *data;
|
ParseeData *data;
|
||||||
DbRef *ref;
|
DbRef *ref;
|
||||||
if (!ParseeConfigGet())
|
if (!ParseeConfigGet())
|
||||||
|
|
@ -37,7 +38,10 @@ ParseeInitData(XMPPComponent *comp)
|
||||||
if (!data->db)
|
if (!data->db)
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, "LMDB doesn't seem to be setup.");
|
Log(LOG_WARNING, "LMDB doesn't seem to be setup.");
|
||||||
|
if (data->config->db_size)
|
||||||
|
{
|
||||||
Log(LOG_WARNING, "Falling back to flat-file.");
|
Log(LOG_WARNING, "Falling back to flat-file.");
|
||||||
|
}
|
||||||
data->db = DbOpen(data->config->db_path, 0);
|
data->db = DbOpen(data->config->db_path, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,6 +53,27 @@ ParseeInitData(XMPPComponent *comp)
|
||||||
Free(id);
|
Free(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version = GrabString(DbJson(ref), 1, "version");
|
||||||
|
if (!ParseeIsCompatible(VERSION, version))
|
||||||
|
{
|
||||||
|
Log(LOG_WARNING, "Version mismatch(curr=%s db=%s).", VERSION, version);
|
||||||
|
Log(LOG_WARNING, "Yeah. You may want to _not_ do that.");
|
||||||
|
|
||||||
|
DbUnlock(data->db, ref);
|
||||||
|
DbClose(data->db);
|
||||||
|
|
||||||
|
HashMapFree(data->oid_servers);
|
||||||
|
pthread_mutex_destroy(&data->oidl);
|
||||||
|
|
||||||
|
XMPPEndCompStream(data->jabber);
|
||||||
|
|
||||||
|
HttpRouterFree(data->router);
|
||||||
|
CommandFreeRouter(data->handler);
|
||||||
|
|
||||||
|
Free(data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
data->id = StrDuplicate(GrabString(DbJson(ref), 1, "identifier"));
|
data->id = StrDuplicate(GrabString(DbJson(ref), 1, "identifier"));
|
||||||
DbUnlock(data->db, ref);
|
DbUnlock(data->db, ref);
|
||||||
|
|
||||||
|
|
|
||||||
53
src/Parsee/Versions.c
Normal file
53
src/Parsee/Versions.c
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include <Parsee.h>
|
||||||
|
|
||||||
|
#include <Cytoplasm/Memory.h>
|
||||||
|
#include <Cytoplasm/Str.h>
|
||||||
|
|
||||||
|
bool
|
||||||
|
ParseeIsCompatible(char *ver1, char *ver2)
|
||||||
|
{
|
||||||
|
char *major1 = NULL;
|
||||||
|
char *major2 = NULL;
|
||||||
|
char *tmp;
|
||||||
|
if (!ver1 || !ver2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if one of them is a "flipped"(joke) version. If so,
|
||||||
|
* then the user should definitely NOT try funny things with
|
||||||
|
* their data. */
|
||||||
|
if (*ver1 == '-' || *ver2 == '-')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GetMajor(v) do \
|
||||||
|
{ \
|
||||||
|
while (*ver##v != '.') \
|
||||||
|
{ \
|
||||||
|
char cb[2]; \
|
||||||
|
cb[0] = *ver##v; \
|
||||||
|
cb[1] = '\0'; \
|
||||||
|
tmp = major##v; \
|
||||||
|
major##v = StrConcat(2, major##v, cb); \
|
||||||
|
Free(tmp); \
|
||||||
|
ver##v++; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
GetMajor(1);
|
||||||
|
GetMajor(2);
|
||||||
|
|
||||||
|
if (!StrEquals(major1, major2))
|
||||||
|
{
|
||||||
|
Free(major1);
|
||||||
|
Free(major2);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Free(major1);
|
||||||
|
Free(major2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
@ -303,9 +303,9 @@ end_error:
|
||||||
args->config, mroom_id, encoded,
|
args->config, mroom_id, encoded,
|
||||||
"m.room.message", content
|
"m.room.message", content
|
||||||
);
|
);
|
||||||
Free(mime);
|
|
||||||
Free(mxc);
|
Free(mxc);
|
||||||
}
|
}
|
||||||
|
Free(mime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reactions)
|
else if (reactions)
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,12 @@ extern const char *parsee_ascii[PARSEE_ASCII_LINES];
|
||||||
* Modifies: the logger output */
|
* Modifies: the logger output */
|
||||||
extern void ParseePrintASCII(void);
|
extern void ParseePrintASCII(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if two versions of Parsee can be considered "compatible".
|
||||||
|
* ---------------
|
||||||
|
* Modifies: NOTHING */
|
||||||
|
extern bool ParseeIsCompatible(char *ver1, char *ver2);
|
||||||
|
|
||||||
/** Generates a valid, getopt-style argument list from a end-terminated
|
/** Generates a valid, getopt-style argument list from a end-terminated
|
||||||
* argument list.
|
* argument list.
|
||||||
* ------------
|
* ------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue