diff options
author | Bruno Haible <bruno@clisp.org> | 2020-05-02 01:56:17 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-05-02 01:56:17 +0200 |
commit | 0ed596dfa4990aa25378bb09e4217f9f50f13973 (patch) | |
tree | fed620385dae72f0c3e4f751ce8828d2b0afee28 /lib/gl_rbtreehash_list.c | |
parent | 050f21384806c88a1227e435b7dd32fef5737e1e (diff) | |
download | gnulib-0ed596dfa4990aa25378bb09e4217f9f50f13973.tar.gz |
list: Add remove_first and remove_last operations.
Suggested by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00092.html>.
* lib/gl_list.h (struct gl_list_implementation): Add fields
remove_first, remove_last.
(gl_list_remove_first, gl_list_remove_last): New functions.
* lib/gl_array_list.c (gl_array_remove_first, gl_array_remove_last): New
functions, based on gl_array_remove_at.
(gl_array_list_implementation): Implement the new operations.
* lib/gl_carray_list.c (gl_carray_remove_first, gl_carray_remove_last):
New functions, based on gl_carray_remove_at.
(gl_carray_list_implementation): Implement the new operations.
* lib/gl_anylinked_list2.h (gl_linked_remove_first,
gl_linked_remove_last): New functions, based on gl_linked_remove_at.
* lib/gl_linked_list.c (gl_linked_list_implementation): Implement the
new operations.
* lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation):
Likewise.
* lib/gl_anytree_list2.h (gl_tree_remove_first, gl_tree_remove_last):
New functions, based on gl_tree_remove_at.
* lib/gl_avltree_list.c (gl_avltree_list_implementation): Implement the
new operations.
* lib/gl_avltreehash_list.c (gl_avltreehash_list_implementation):
Likewise.
* lib/gl_rbtree_list.c (gl_rbtree_list_implementation): Likewise.
* lib/gl_rbtreehash_list.c (gl_rbtreehash_list_implementation):
Likewise.
* lib/gl_sublist.c (gl_sublist_remove_first, gl_sublist_remove_last):
New functions, based on gl_sublist_remove_at.
(gl_sublist_list_implementation): Implement the new operations.
* lib/gl_list.hh (class gl_List): Add methods remove_first,
remove_last.
* tests/test-array_list.c (main): Test also gl_list_remove_first and
gl_list_remove_last.
* tests/test-avltree_list.c (main): Likewise.
* tests/test-avltreehash_list.c (main): Likewise.
* tests/test-carray_list.c (main): Likewise.
* tests/test-linked_list.c (main): Likewise.
* tests/test-linkedhash_list.c (main): Likewise.
* tests/test-rbtree_list.c (main): Likewise.
* tests/test-rbtreehash_list.c (main): Likewise.
Diffstat (limited to 'lib/gl_rbtreehash_list.c')
-rw-r--r-- | lib/gl_rbtreehash_list.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gl_rbtreehash_list.c b/lib/gl_rbtreehash_list.c index be2ee6f4e9..b59b5f4877 100644 --- a/lib/gl_rbtreehash_list.c +++ b/lib/gl_rbtreehash_list.c @@ -112,6 +112,8 @@ const struct gl_list_implementation gl_rbtreehash_list_implementation = gl_tree_nx_add_at, gl_tree_remove_node, gl_tree_remove_at, + gl_tree_remove_first, + gl_tree_remove_last, gl_tree_remove, gl_tree_list_free, gl_tree_iterator, |