X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgl_list.h;h=2b3aa58fe4e042d09800949f620f1b2e25dc65ed;hb=758fee15d9627556a3f0011973e83afb8d56d9be;hp=b97a6a42a3dde50bf1e5e51f25b597b6b87e3dd5;hpb=a6f4f3f4b51415133678af1c269b68b68ae7f4df;p=gnulib.git diff --git a/lib/gl_list.h b/lib/gl_list.h index b97a6a42a..2b3aa58fe 100644 --- a/lib/gl_list.h +++ b/lib/gl_list.h @@ -1,11 +1,11 @@ /* Abstract sequential list data type. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2010 Free Software Foundation, Inc. Written by Bruno Haible , 2006. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ #ifndef _GL_LIST_H #define _GL_LIST_H @@ -58,11 +57,12 @@ extern "C" { n elements: Operation ARRAY LINKED TREE LINKEDHASH TREEHASH - CARRAY with|without with|without - duplicates duplicates + CARRAY with|without with|without + duplicates duplicates gl_list_size O(1) O(1) O(1) O(1) O(1) gl_list_node_value O(1) O(1) O(1) O(1) O(1) + gl_list_node_set_value O(1) O(1) O(1) O(1) O((log n)²)/O(1) gl_list_next_node O(1) O(1) O(log n) O(1) O(log n) gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n) gl_list_get_at O(1) O(n) O(log n) O(n) O(log n) @@ -102,6 +102,10 @@ typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2); NULL denotes a function that depends only on the pointer itself. */ typedef size_t (*gl_listelement_hashcode_fn) (const void *elt); +/* Type of function used to dispose an element once it's removed from a list. + NULL denotes a no-op. */ +typedef void (*gl_listelement_dispose_fn) (const void *elt); + struct gl_list_impl; /* Type representing an entire list. */ typedef struct gl_list_impl * gl_list_t; @@ -122,12 +126,22 @@ typedef const struct gl_list_implementation * gl_list_implementation_t; GL_RBTREEHASH_LIST. EQUALS_FN is an element comparison function or NULL. HASHCODE_FN is an element hash code function or NULL. + DISPOSE_FN is an element disposal function or NULL. ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in the list. The implementation may verify this at runtime. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates); + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_t gl_list_nx_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); /* Create a list with given contents. IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST, @@ -135,15 +149,26 @@ extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation, GL_RBTREEHASH_LIST. EQUALS_FN is an element comparison function or NULL. HASHCODE_FN is an element hash code function or NULL. + DISPOSE_FN is an element disposal function or NULL. ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in the list. The implementation may verify this at runtime. COUNT is the number of initial elements. CONTENTS[0..COUNT-1] is the initial contents. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_t gl_list_create (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates, - size_t count, const void **contents); + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_t gl_list_nx_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); /* Return the current number of elements in a list. */ extern size_t gl_list_size (gl_list_t list); @@ -151,6 +176,19 @@ extern size_t gl_list_size (gl_list_t list); /* Return the element value represented by a list node. */ extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node); +/* Replace the element value represented by a list node. */ +#if 0 /* declared in gl_xlist.h */ +extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node, + const void *elt); +#endif +/* Likewise. Return 0 upon success, -1 upon out-of-memory. */ +extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; + /* Return the node immediately after the given node in the list, or NULL if the given node is the last (rightmost) one in the list. */ extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node); @@ -166,8 +204,17 @@ extern const void * gl_list_get_at (gl_list_t list, size_t position); /* Replace the element at a given position in the list. POSITION must be >= 0 and < gl_list_size (list). Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position, - const void *elt); + const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Search whether an element is already in the list. Return its node if found, or NULL if not present in the list. */ @@ -177,15 +224,15 @@ extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt); at a position >= START_INDEX. Return its node if found, or NULL if not present in the list. */ extern gl_list_node_t gl_list_search_from (gl_list_t list, size_t start_index, - const void *elt); + const void *elt); /* Search whether an element is already in the list, at a position >= START_INDEX and < END_INDEX. Return its node if found, or NULL if not present in the list. */ extern gl_list_node_t gl_list_search_from_to (gl_list_t list, - size_t start_index, - size_t end_index, - const void *elt); + size_t start_index, + size_t end_index, + const void *elt); /* Search whether an element is already in the list. Return its position if found, or (size_t)(-1) if not present in the list. */ @@ -195,37 +242,81 @@ extern size_t gl_list_indexof (gl_list_t list, const void *elt); at a position >= START_INDEX. Return its position if found, or (size_t)(-1) if not present in the list. */ extern size_t gl_list_indexof_from (gl_list_t list, size_t start_index, - const void *elt); + const void *elt); /* Search whether an element is already in the list, at a position >= START_INDEX and < END_INDEX. Return its position if found, or (size_t)(-1) if not present in the list. */ extern size_t gl_list_indexof_from_to (gl_list_t list, - size_t start_index, size_t end_index, - const void *elt); + size_t start_index, size_t end_index, + const void *elt); /* Add an element as the first element of the list. Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Add an element as the last element of the list. Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Add an element before a given element node of the list. Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node, - const void *elt); + const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_before (gl_list_t list, + gl_list_node_t node, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Add an element after a given element node of the list. Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node, - const void *elt); + const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; -/* Add an element add a given position in the list. +/* Add an element at a given position in the list. POSITION must be >= 0 and <= gl_list_size (list). */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position, - const void *elt); + const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Remove an element from the list. Return true. */ @@ -273,14 +364,14 @@ extern gl_list_iterator_t gl_list_iterator (gl_list_t list); The list contents must not be modified while the iterator is in use, except for replacing or removing the last returned element. */ extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list, - size_t start_index, - size_t end_index); + size_t start_index, + size_t end_index); /* If there is a next element, store the next element in *ELTP, store its node in *NODEP if NODEP is non-NULL, advance the iterator and return true. Otherwise, return false. */ extern bool gl_list_iterator_next (gl_list_iterator_t *iterator, - const void **eltp, gl_list_node_t *nodep); + const void **eltp, gl_list_node_t *nodep); /* Free an iterator. */ extern void gl_list_iterator_free (gl_list_iterator_t *iterator); @@ -300,8 +391,8 @@ typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2); If the list contains several copies of ELT, the node of the leftmost one is returned. */ extern gl_list_node_t gl_sortedlist_search (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); /* Search whether an element is already in the list. The list is assumed to be sorted with COMPAR. @@ -312,10 +403,10 @@ extern gl_list_node_t gl_sortedlist_search (gl_list_t list, If the list contains several copies of ELT, the node of the leftmost one is returned. */ extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list, - gl_listelement_compar_fn compar, - size_t start_index, - size_t end_index, - const void *elt); + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); /* Search whether an element is already in the list. The list is assumed to be sorted with COMPAR. @@ -323,8 +414,8 @@ extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list, If the list contains several copies of ELT, the position of the leftmost one is returned. */ extern size_t gl_sortedlist_indexof (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); /* Search whether an element is already in the list. The list is assumed to be sorted with COMPAR. @@ -335,17 +426,27 @@ extern size_t gl_sortedlist_indexof (gl_list_t list, If the list contains several copies of ELT, the position of the leftmost one is returned. */ extern size_t gl_sortedlist_indexof_from_to (gl_list_t list, - gl_listelement_compar_fn compar, - size_t start_index, - size_t end_index, - const void *elt); + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); /* Add an element at the appropriate position in the list. The list is assumed to be sorted with COMPAR. Return its node. */ +#if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_sortedlist_add (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); +#endif +/* Likewise. Return NULL upon out-of-memory. */ +extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt) +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + __attribute__ ((__warn_unused_result__)) +#endif + ; /* Search and remove an element from the list. The list is assumed to be sorted with COMPAR. @@ -353,75 +454,80 @@ extern gl_list_node_t gl_sortedlist_add (gl_list_t list, If the list contains several copies of ELT, only the leftmost one is removed. */ extern bool gl_sortedlist_remove (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); /* ------------------------ Implementation Details ------------------------ */ struct gl_list_implementation { /* gl_list_t functions. */ - gl_list_t (*create_empty) (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates); - gl_list_t (*create) (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates, - size_t count, const void **contents); + gl_list_t (*nx_create_empty) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); + gl_list_t (*nx_create) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); size_t (*size) (gl_list_t list); const void * (*node_value) (gl_list_t list, gl_list_node_t node); + int (*node_nx_set_value) (gl_list_t list, gl_list_node_t node, + const void *elt); gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node); gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node); const void * (*get_at) (gl_list_t list, size_t position); - gl_list_node_t (*set_at) (gl_list_t list, size_t position, const void *elt); + gl_list_node_t (*nx_set_at) (gl_list_t list, size_t position, + const void *elt); gl_list_node_t (*search_from_to) (gl_list_t list, size_t start_index, - size_t end_index, const void *elt); + size_t end_index, const void *elt); size_t (*indexof_from_to) (gl_list_t list, size_t start_index, - size_t end_index, const void *elt); - gl_list_node_t (*add_first) (gl_list_t list, const void *elt); - gl_list_node_t (*add_last) (gl_list_t list, const void *elt); - gl_list_node_t (*add_before) (gl_list_t list, gl_list_node_t node, - const void *elt); - gl_list_node_t (*add_after) (gl_list_t list, gl_list_node_t node, - const void *elt); - gl_list_node_t (*add_at) (gl_list_t list, size_t position, - const void *elt); + size_t end_index, const void *elt); + gl_list_node_t (*nx_add_first) (gl_list_t list, const void *elt); + gl_list_node_t (*nx_add_last) (gl_list_t list, const void *elt); + gl_list_node_t (*nx_add_before) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*nx_add_after) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*nx_add_at) (gl_list_t list, size_t position, + const void *elt); bool (*remove_node) (gl_list_t list, gl_list_node_t node); bool (*remove_at) (gl_list_t list, size_t position); - bool (*remove) (gl_list_t list, const void *elt); + bool (*remove_elt) (gl_list_t list, const void *elt); void (*list_free) (gl_list_t list); /* gl_list_iterator_t functions. */ gl_list_iterator_t (*iterator) (gl_list_t list); gl_list_iterator_t (*iterator_from_to) (gl_list_t list, - size_t start_index, - size_t end_index); + size_t start_index, + size_t end_index); bool (*iterator_next) (gl_list_iterator_t *iterator, - const void **eltp, gl_list_node_t *nodep); + const void **eltp, gl_list_node_t *nodep); void (*iterator_free) (gl_list_iterator_t *iterator); /* Sorted gl_list_t functions. */ gl_list_node_t (*sortedlist_search) (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); gl_list_node_t (*sortedlist_search_from_to) (gl_list_t list, - gl_listelement_compar_fn compar, - size_t start_index, - size_t end_index, - const void *elt); + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); size_t (*sortedlist_indexof) (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); size_t (*sortedlist_indexof_from_to) (gl_list_t list, - gl_listelement_compar_fn compar, - size_t start_index, size_t end_index, - const void *elt); - gl_list_node_t (*sortedlist_add) (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + size_t start_index, size_t end_index, + const void *elt); + gl_list_node_t (*sortedlist_nx_add) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); bool (*sortedlist_remove) (gl_list_t list, - gl_listelement_compar_fn compar, - const void *elt); + gl_listelement_compar_fn compar, + const void *elt); }; struct gl_list_impl_base @@ -429,6 +535,7 @@ struct gl_list_impl_base const struct gl_list_implementation *vtable; gl_listelement_equals_fn equals_fn; gl_listelement_hashcode_fn hashcode_fn; + gl_listelement_dispose_fn dispose_fn; bool allow_duplicates; }; @@ -438,27 +545,31 @@ struct gl_list_impl_base struct gl_list_implementation. Use #define to avoid a warning because of extern vs. static. */ -# define gl_list_create_empty gl_list_create_empty_inline +# define gl_list_nx_create_empty gl_list_nx_create_empty_inline static inline gl_list_t -gl_list_create_empty (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates) +gl_list_nx_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates) { - return implementation->create_empty (implementation, equals_fn, hashcode_fn, - allow_duplicates); + return implementation->nx_create_empty (implementation, equals_fn, + hashcode_fn, dispose_fn, + allow_duplicates); } -# define gl_list_create gl_list_create_inline +# define gl_list_nx_create gl_list_nx_create_inline static inline gl_list_t -gl_list_create (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - bool allow_duplicates, - size_t count, const void **contents) +gl_list_nx_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) { - return implementation->create (implementation, equals_fn, hashcode_fn, - allow_duplicates, count, contents); + return implementation->nx_create (implementation, equals_fn, hashcode_fn, + dispose_fn, allow_duplicates, count, + contents); } # define gl_list_size gl_list_size_inline @@ -466,7 +577,7 @@ static inline size_t gl_list_size (gl_list_t list) { return ((const struct gl_list_impl_base *) list)->vtable - ->size (list); + ->size (list); } # define gl_list_node_value gl_list_node_value_inline @@ -474,7 +585,16 @@ static inline const void * gl_list_node_value (gl_list_t list, gl_list_node_t node) { return ((const struct gl_list_impl_base *) list)->vtable - ->node_value (list, node); + ->node_value (list, node); +} + +# define gl_list_node_nx_set_value gl_list_node_nx_set_value_inline +static inline int +gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->node_nx_set_value (list, node, elt); } # define gl_list_next_node gl_list_next_node_inline @@ -482,7 +602,7 @@ static inline gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node) { return ((const struct gl_list_impl_base *) list)->vtable - ->next_node (list, node); + ->next_node (list, node); } # define gl_list_previous_node gl_list_previous_node_inline @@ -490,7 +610,7 @@ static inline gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node) { return ((const struct gl_list_impl_base *) list)->vtable - ->previous_node (list, node); + ->previous_node (list, node); } # define gl_list_get_at gl_list_get_at_inline @@ -498,15 +618,15 @@ static inline const void * gl_list_get_at (gl_list_t list, size_t position) { return ((const struct gl_list_impl_base *) list)->vtable - ->get_at (list, position); + ->get_at (list, position); } -# define gl_list_set_at gl_list_set_at_inline +# define gl_list_nx_set_at gl_list_nx_set_at_inline static inline gl_list_node_t -gl_list_set_at (gl_list_t list, size_t position, const void *elt) +gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->set_at (list, position, elt); + ->nx_set_at (list, position, elt); } # define gl_list_search gl_list_search_inline @@ -515,7 +635,7 @@ gl_list_search (gl_list_t list, const void *elt) { size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); return ((const struct gl_list_impl_base *) list)->vtable - ->search_from_to (list, 0, size, elt); + ->search_from_to (list, 0, size, elt); } # define gl_list_search_from gl_list_search_from_inline @@ -524,16 +644,16 @@ gl_list_search_from (gl_list_t list, size_t start_index, const void *elt) { size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); return ((const struct gl_list_impl_base *) list)->vtable - ->search_from_to (list, start_index, size, elt); + ->search_from_to (list, start_index, size, elt); } # define gl_list_search_from_to gl_list_search_from_to_inline static inline gl_list_node_t gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index, - const void *elt) + const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->search_from_to (list, start_index, end_index, elt); + ->search_from_to (list, start_index, end_index, elt); } # define gl_list_indexof gl_list_indexof_inline @@ -542,7 +662,7 @@ gl_list_indexof (gl_list_t list, const void *elt) { size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); return ((const struct gl_list_impl_base *) list)->vtable - ->indexof_from_to (list, 0, size, elt); + ->indexof_from_to (list, 0, size, elt); } # define gl_list_indexof_from gl_list_indexof_from_inline @@ -551,56 +671,56 @@ gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt) { size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); return ((const struct gl_list_impl_base *) list)->vtable - ->indexof_from_to (list, start_index, size, elt); + ->indexof_from_to (list, start_index, size, elt); } # define gl_list_indexof_from_to gl_list_indexof_from_to_inline static inline size_t gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, - const void *elt) + const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->indexof_from_to (list, start_index, end_index, elt); + ->indexof_from_to (list, start_index, end_index, elt); } -# define gl_list_add_first gl_list_add_first_inline +# define gl_list_nx_add_first gl_list_nx_add_first_inline static inline gl_list_node_t -gl_list_add_first (gl_list_t list, const void *elt) +gl_list_nx_add_first (gl_list_t list, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->add_first (list, elt); + ->nx_add_first (list, elt); } -# define gl_list_add_last gl_list_add_last_inline +# define gl_list_nx_add_last gl_list_nx_add_last_inline static inline gl_list_node_t -gl_list_add_last (gl_list_t list, const void *elt) +gl_list_nx_add_last (gl_list_t list, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->add_last (list, elt); + ->nx_add_last (list, elt); } -# define gl_list_add_before gl_list_add_before_inline +# define gl_list_nx_add_before gl_list_nx_add_before_inline static inline gl_list_node_t -gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->add_before (list, node, elt); + ->nx_add_before (list, node, elt); } -# define gl_list_add_after gl_list_add_after_inline +# define gl_list_nx_add_after gl_list_nx_add_after_inline static inline gl_list_node_t -gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->add_after (list, node, elt); + ->nx_add_after (list, node, elt); } -# define gl_list_add_at gl_list_add_at_inline +# define gl_list_nx_add_at gl_list_nx_add_at_inline static inline gl_list_node_t -gl_list_add_at (gl_list_t list, size_t position, const void *elt) +gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->add_at (list, position, elt); + ->nx_add_at (list, position, elt); } # define gl_list_remove_node gl_list_remove_node_inline @@ -608,7 +728,7 @@ static inline bool gl_list_remove_node (gl_list_t list, gl_list_node_t node) { return ((const struct gl_list_impl_base *) list)->vtable - ->remove_node (list, node); + ->remove_node (list, node); } # define gl_list_remove_at gl_list_remove_at_inline @@ -616,7 +736,7 @@ static inline bool gl_list_remove_at (gl_list_t list, size_t position) { return ((const struct gl_list_impl_base *) list)->vtable - ->remove_at (list, position); + ->remove_at (list, position); } # define gl_list_remove gl_list_remove_inline @@ -624,7 +744,7 @@ static inline bool gl_list_remove (gl_list_t list, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->remove (list, elt); + ->remove_elt (list, elt); } # define gl_list_free gl_list_free_inline @@ -639,7 +759,7 @@ static inline gl_list_iterator_t gl_list_iterator (gl_list_t list) { return ((const struct gl_list_impl_base *) list)->vtable - ->iterator (list); + ->iterator (list); } # define gl_list_iterator_from_to gl_list_iterator_from_to_inline @@ -647,13 +767,13 @@ static inline gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) { return ((const struct gl_list_impl_base *) list)->vtable - ->iterator_from_to (list, start_index, end_index); + ->iterator_from_to (list, start_index, end_index); } # define gl_list_iterator_next gl_list_iterator_next_inline static inline bool gl_list_iterator_next (gl_list_iterator_t *iterator, - const void **eltp, gl_list_node_t *nodep) + const void **eltp, gl_list_node_t *nodep) { return iterator->vtable->iterator_next (iterator, eltp, nodep); } @@ -670,7 +790,7 @@ static inline gl_list_node_t gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_search (list, compar, elt); + ->sortedlist_search (list, compar, elt); } # define gl_sortedlist_search_from_to gl_sortedlist_search_from_to_inline @@ -678,8 +798,8 @@ static inline gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_search_from_to (list, compar, start_index, end_index, - elt); + ->sortedlist_search_from_to (list, compar, start_index, end_index, + elt); } # define gl_sortedlist_indexof gl_sortedlist_indexof_inline @@ -687,7 +807,7 @@ static inline size_t gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_indexof (list, compar, elt); + ->sortedlist_indexof (list, compar, elt); } # define gl_sortedlist_indexof_from_to gl_sortedlist_indexof_from_to_inline @@ -695,16 +815,16 @@ static inline size_t gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_indexof_from_to (list, compar, start_index, end_index, - elt); + ->sortedlist_indexof_from_to (list, compar, start_index, end_index, + elt); } -# define gl_sortedlist_add gl_sortedlist_add_inline +# define gl_sortedlist_nx_add gl_sortedlist_nx_add_inline static inline gl_list_node_t -gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_add (list, compar, elt); + ->sortedlist_nx_add (list, compar, elt); } # define gl_sortedlist_remove gl_sortedlist_remove_inline @@ -712,7 +832,7 @@ static inline bool gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { return ((const struct gl_list_impl_base *) list)->vtable - ->sortedlist_remove (list, compar, elt); + ->sortedlist_remove (list, compar, elt); } #endif