diff options
author | Bruno Haible <bruno@clisp.org> | 2020-05-02 21:14:29 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-05-02 23:22:13 +0200 |
commit | da5396455733d383a4ac4d0cf7eb4cd191072352 (patch) | |
tree | 1ee388f461968b045e34f6f86bb6b2128688a363 /lib/gl_anytree_list2.h | |
parent | 792c2571d96142bfb97b690579da25fd734735b3 (diff) | |
download | gnulib-da5396455733d383a4ac4d0cf7eb4cd191072352.tar.gz |
list: Remove redundant code for remove_first and remove_last operations.
* lib/gl_list.h (struct gl_list_implementation): Remove fields
remove_first, remove_last.
(gl_list_remove_first, gl_list_remove_last): Implement in a generic way.
* lib/gl_array_list.c: Revert last change.
* lib/gl_carray_list.c: Likewise.
* lib/gl_anylinked_list2.h: Likewise.
* lib/gl_linked_list.c: Likewise.
* lib/gl_linkedhash_list.c: Likewise.
* lib/gl_anytree_list2.h: Likewise.
* lib/gl_avltree_list.c: Likewise.
* lib/gl_avltreehash_list.c: Likewise.
* lib/gl_rbtree_list.c: Likewise.
* lib/gl_rbtreehash_list.c: Likewise.
* lib/gl_sublist.c: Likewise.
Diffstat (limited to 'lib/gl_anytree_list2.h')
-rw-r--r-- | lib/gl_anytree_list2.h | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h index 41e41dd81b..c5a67dbd0c 100644 --- a/lib/gl_anytree_list2.h +++ b/lib/gl_anytree_list2.h @@ -486,34 +486,6 @@ gl_tree_remove_at (gl_list_t list, size_t position) } static bool -gl_tree_remove_first (gl_list_t list) -{ - gl_list_node_t node = list->root; - - if (node != NULL) - { - node = node_at (node, 0); - return gl_tree_remove_node (list, node); - } - else - return false; -} - -static bool -gl_tree_remove_last (gl_list_t list) -{ - gl_list_node_t node = list->root; - - if (node != NULL) - { - node = node_at (node, node->branch_size - 1); - return gl_tree_remove_node (list, node); - } - else - return false; -} - -static bool gl_tree_remove (gl_list_t list, const void *elt) { if (list->root != NULL) |