# HG changeset patch # User Mike Becker # Date 1632650618 -7200 # Node ID ab30d32ae798343c52f77a4ef8ffb78b5b711947 # Parent a79b2388db5e903024237df0556ef7bc77453511# Parent 4b1203dbd0a66f5905be07ae33b2fd1dad4f38d8 merge with remote default diff -r 4b1203dbd0a6 -r ab30d32ae798 src/cx/allocator.h --- a/src/cx/allocator.h Sun Aug 22 14:33:06 2021 +0200 +++ b/src/cx/allocator.h Sun Sep 26 12:03:38 2021 +0200 @@ -31,6 +31,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { void *(*malloc)(void *data, size_t n); void *(*realloc)(void *data, void *mem, size_t n); @@ -58,4 +62,8 @@ void cxFree(CxAllocator allocator, void *mem); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* UCX_ALLOCATOR_H */ diff -r 4b1203dbd0a6 -r ab30d32ae798 src/cx/linked_list.h --- a/src/cx/linked_list.h Sun Aug 22 14:33:06 2021 +0200 +++ b/src/cx/linked_list.h Sun Sep 26 12:03:38 2021 +0200 @@ -32,6 +32,10 @@ #include #include "list.h" +#ifdef __cplusplus +extern "C" { +#endif + void *cx_linked_list_last(void **begin, void **end, ptrdiff_t loc_next); int cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node); @@ -44,4 +48,8 @@ size_t cxLinkedListRecalculateSize(CxList list); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* UCX_LINKED_LIST_H */ diff -r 4b1203dbd0a6 -r ab30d32ae798 src/cx/list.h --- a/src/cx/list.h Sun Aug 22 14:33:06 2021 +0200 +++ b/src/cx/list.h Sun Sep 26 12:03:38 2021 +0200 @@ -32,6 +32,10 @@ #include #include "allocator.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef int(*CxListComparator)(void const *left, void const *right); typedef struct { @@ -45,9 +49,13 @@ typedef struct { int (*add)(cx_list *list, void *elem); + int (*insert)(cx_list *list, size_t index, void *elem); + void *(*remove)(cx_list *list, size_t index); + size_t (*find)(cx_list *list, void *elem); + void *(*last)(cx_list *list); } cx_list_class; @@ -68,4 +76,8 @@ void *cxListLast(CxList list); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* UCX_LIST_H */ diff -r 4b1203dbd0a6 -r ab30d32ae798 src/linked_list.c --- a/src/linked_list.c Sun Aug 22 14:33:06 2021 +0200 +++ b/src/linked_list.c Sun Sep 26 12:03:38 2021 +0200 @@ -52,11 +52,6 @@ } int cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node) { - // TODO: how do we report error messages? - if (loc_next < 0 || (begin == NULL && end == NULL)) { - return 1; - } - void *last = cx_linked_list_last(begin, end, loc_next); if (last == NULL) { if (begin == NULL) {