diff --git a/include/extra/array.h b/include/extra/array.h index 6ec3825..af89ba0 100644 --- a/include/extra/array.h +++ b/include/extra/array.h @@ -10,11 +10,13 @@ #define array_pop(x, s, index) libcdsb_array_get(x, s, index, 1) #define array_remove(s, index) libcdsb_array_get(0, s, index, 1) +#define array_foreach libcdsb_array_foreach + extern ssize_t libcdsb_array_get(vtype_value* x, vtype_array* s, ssize_t index, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; extern ssize_t libcdsb_array_find(const vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__; extern ssize_t libcdsb_array_push( vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int array_foreach(vtype_array* x, int (*callback)(void* value, ssize_t index, vtype type)) LIBCDSB_nt__ LIBCDSB_nn12__; +extern int libcdsb_array_foreach(vtype_array* x, int (*callback)(void* value, ssize_t index, vtype type)) LIBCDSB_nt__ LIBCDSB_nn12__; #endif /* LIBCDSB_EXTRA_ARRAY_H */ diff --git a/include/extra/list.h b/include/extra/list.h index 68f1168..6ef3c89 100644 --- a/include/extra/list.h +++ b/include/extra/list.h @@ -1,7 +1,6 @@ /* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ -#include #include "../list.h" #ifndef LIBCDSB_EXTRA_LIST_H @@ -11,6 +10,8 @@ #define list_pop_by_index(x, s, index) libcdsb_list_get(x, s, index, 1) #define list_remove_by_index(s, index) libcdsb_list_get(0, s, index, 1) +#define list_foreach libcdsb_list_foreach + extern ssize_t libcdsb_list_find (vtype_value* x, vtype_list* s, const void* value, vtype type, _Bool reverse, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; extern _Bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) LIBCDSB_nt__ LIBCDSB_nn1__; @@ -18,6 +19,6 @@ extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype extern ssize_t libcdsb_list_get(vtype_value* x, vtype_list* s, ssize_t index, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; -extern int list_foreach(const vtype_list* x, int (*callback)(void* value, ssize_t index, vtype type)) LIBCDSB_nt__ LIBCDSB_nn12__; +extern int libcdsb_list_foreach(const vtype_list* x, int (*callback)(void* value, ssize_t index, vtype type)) LIBCDSB_nt__ LIBCDSB_nn12__; #endif /* LIBCDSB_EXTRA_LIST_H */ diff --git a/src/array/extra.c b/src/array/extra.c index 25b1d2c..99070e1 100644 --- a/src/array/extra.c +++ b/src/array/extra.c @@ -76,7 +76,7 @@ ssize_t libcdsb_array_get(val_t* x, arr_t* s, ssize_t i, _Bool cut) { /*#####################################################################################################################*/ -int array_foreach(vtype_array* x, int (*callback)(void* value, ssize_t index, vtype type)) { +int libcdsb_array_foreach(vtype_array* x, int (*callback)(void* value, ssize_t index, vtype type)) { void* p; void* e; diff --git a/src/list/extra.c b/src/list/extra.c index 6429bcd..570b679 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -163,7 +163,7 @@ _Bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) /*#####################################################################################################################*/ -int list_foreach(const vtype_list* x, int (*callback)(void* value, ssize_t index, vtype type)) { +int libcdsb_list_foreach(const vtype_list* x, int (*callback)(void* value, ssize_t index, vtype type)) { lnode_t* c; size_t n;