WIP: use latest clibs with selist.

adding a transitional quicklist.c module to reduce work.
This commit is contained in:
Enno Rehling 2017-01-26 06:00:01 +01:00
parent 3ff5a3155e
commit 955997d58c
5 changed files with 22 additions and 3 deletions

2
clibs

@ -1 +1 @@
Subproject commit bce9b6568d4e9ace26c95a7740140cd71029b21f Subproject commit 339ac5680ec9027c88c4516c72b9da8233b6f3e3

View File

@ -88,6 +88,7 @@ set (ERESSEA_SRC
move.c move.c
piracy.c piracy.c
spells.c spells.c
quicklist.c
battle.c battle.c
alchemy.c alchemy.c
academy.c academy.c

View File

@ -54,8 +54,8 @@ void add_donation(faction * f1, faction * f2, int amount, region * r)
} }
void free_donations(void) { void free_donations(void) {
ql_foreach(transfers, free); selist_foreach(transfers, free);
ql_free(transfers); selist_free(transfers);
transfers = 0; transfers = 0;
} }

4
src/quicklist.c Normal file
View File

@ -0,0 +1,4 @@
#include "quicklist.h"
bool ql_set_insert_ex(struct quicklist **qlp, void *data, int (*cmp_cb)(const void *lhs, const void *rhs));
bool ql_set_find_ex(struct quicklist **qlp, int *qip, const void *data, int (*cmp_cb)(const void *lhs, const void *rhs));

14
src/quicklist.h Normal file
View File

@ -0,0 +1,14 @@
#pragma once
#define selist quicklist
#define selist_free ql_free
#define selist_get ql_get
#define selist_push ql_push
#define selist_empty ql_empty
#define selist_advance ql_advance
#include <selist.h>
#include <stdbool.h>
typedef void(*ql_cb)(void *);
bool ql_set_insert_ex(struct quicklist **qlp, void *data, int (*cmp_cb)(const void *lhs, const void *rhs));
bool ql_set_find_ex(struct quicklist **qlp, int *qip, const void *data, int (*cmp_cb)(const void *lhs, const void *rhs));