Update array & list (extra) foreach symbols

This commit is contained in:
Gregory Lirent 2022-06-06 11:22:48 +03:00
parent 51c1fbf52d
commit da420ef59d
4 changed files with 8 additions and 5 deletions

View File

@ -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 */

View File

@ -1,7 +1,6 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <assert.h>
#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 */

View File

@ -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;

View File

@ -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;