libcdsb/include/extra/list.h

23 lines
1.3 KiB
C
Raw Normal View History

2022-06-04 18:58:04 +00:00
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../list.h"
#ifndef LIBCDSB_EXTRA_LIST_H
#define LIBCDSB_EXTRA_LIST_H
2022-06-08 17:59:07 +00:00
#define list_get_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 0)
#define list_pop_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 1)
#define list_remove_by_index(x, index) libcdsb_list_get(x, index, 0, 0, 1)
2022-06-04 18:58:04 +00:00
#define list_foreach(x, data, callback) libcdsb_list_foreach(x, data, callback, 0)
2022-08-15 22:36:37 +00:00
extern bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) Nonnull__(1);
extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) Pure__ Warn_unused_result__ Nonnull__(1);
2022-06-04 18:58:04 +00:00
2022-08-15 22:36:37 +00:00
extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback, bool flush) Nonnull__(1,3);
2022-06-05 15:36:48 +00:00
2022-06-04 18:58:04 +00:00
#endif /* LIBCDSB_EXTRA_LIST_H */