Add _hash, _equal_p, _out_str, _in_str, _get_str, _parse_str

for intrusive list.
This commit is contained in:
Patrick Pelissier committed 2018-10-03 22:01:40 +02:00
1 parent 4f3dad4bea
commit c87696f5c1
3 files changed
+8 -2

No files matched your search

BIN
View File
Binary file not shown.
+5 -1
View File
@@ -26,6 +26,7 @@
#define MSTARLIB_I_LIST_H
#include "m-core.h"
#include "m-list.h" // For LISTI_ITBASE_DEF
/* Interface to add to a structure to enable intrusive doubly-linked support.
name: name of the intrusive list.
@@ -587,5 +588,8 @@ typedef struct ilist_head_s {
it->prev = next; \
ILISTI_CONTRACT(name, list); \
} \
\
LISTI_ITBASE_DEF(name, type, oplist, list_t, list_it_t)
#endif
+3 -1
View File
@@ -35,7 +35,7 @@ typedef struct test_s {
#include "coverage.h"
START_COVERAGE
ILIST_DEF(ilist_tname, test_t)
ILIST_DEF(ilist_tname, test_t, M_POD_OPLIST)
END_COVERAGE
ILIST_DEF(ilist_free, test_t, (DEL(free)))
@@ -143,6 +143,7 @@ static void test2(void)
}
assert (ilist_tname_size(list1) == NUM);
assert (ilist_tname_size(list2) == 0);
assert (ilist_tname_equal_p(list1, list2) == false);
ilist_tname_it_t it;
ilist_tname_it (it, list1);
for(int i = 0; i < NUM; i++) {
@@ -151,6 +152,7 @@ static void test2(void)
}
assert (ilist_tname_size(list1) == 0);
assert (ilist_tname_size(list2) == NUM);
assert (ilist_tname_equal_p(list1, list2) == false);
int n = 0;
for M_EACH(item, list2, ILIST_OPLIST(ilist_tname)) {
assert (n == item->n);