Sun, 26 Sep 2021 12:03:38 +0200
merge with remote default
--- 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 <stdlib.h> +#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 */
--- 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 <stddef.h> #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 */
--- 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 <stdlib.h> #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 */
--- 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) {