summaryrefslogtreecommitdiff
path: root/lib/gl_anylinked_list2.h
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-common: update for C2x 2020-12-11 draftPaul Eggert2021-07-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use blessed-by-draft-standard way to test for [[__deprecated__]] etc.; this is supported by GCC 11 and the fallback code should work fine with GCC 10 and earlier, clang, etc. * NEWS, doc/attribute.texi: Mention that DEPRECATED etc. must now come first. * lib/fflush.c, lib/unistr.in.h: Do not include unused-parameter.h. All uses of _GL_UNUSED_PARAMETER (after parameters) replaced by _GL_ATTRIBUTE_MAYBE_UNUSED (before parameters). Although perhaps we need a shorter name for _GL_ATTRIBUTE_MAYBE_UNUSED, that should probably be in gnulib-common.m4, due to the ubiquity of this issue. And perhaps the snippet/unused-parameter module should be marked obsolete since it's no longer compatible with its old use. * m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macro _GL_HAS_C_ATTRIBUTE, and use it instead of __STDC_VERSION__ in deciding whether to use C2x attributes like [[__deprecated__]]. (_GL_ATTRIBUTE_MAYBE_UNUSED): Fall back on _GL_ATTRIBUTE_UNUSED. (_GL_ATTRIBUTE_UNUSED): New macro, for labels where C2x [[maybe_unused]] do not work. (_GL_UNUSED, _GL_UNUSED_LABEL): Use it. * modules/fflush, modules/unistr/base (Depends-on): Remove snippet/unused-parameter. * modules/fflush (selinux/selinux.h, selinux/context.h) (selinux/label.h): Do not use $(UNUSED_PARAMETER). Remove useless chmod a-x.
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-041-7/+7
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* list: Add operations first_node, last_node.Bruno Haible2021-04-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Marc Nieper-Wißkirchen in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00005.html>. * lib/gl_list.h (gl_list_first_node, gl_list_last_node): New functions. (struct gl_list_implementation): Add members first_node, last_node. * lib/gl_array_list.c (gl_array_first_node, gl_array_last_node): New functions. (gl_array_list_implementation): Add the new operations. * lib/gl_carray_list.c (gl_carray_first_node, gl_carray_last_node): New functions. (gl_carray_list_implementation): Add the new operations. * lib/gl_anylinked_list2.h (gl_linked_first_node, gl_linked_last_node): New functions. * lib/gl_linked_list.c (gl_linked_list_implementation): Add the new operations. * lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation): Likewise. * lib/gl_anytree_list2.h (gl_tree_first_node, gl_tree_last_node): New functions. * lib/gl_avltree_list.c (gl_avltree_list_implementation): Add 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_first_node, gl_sublist_last_node): New functions. (gl_sublist_list_implementation): Add the new operations. * lib/gl_list.hh (class gl_List): Add member functions first_node, last_node. * doc/containers.texi: Update table.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* *-list, *-oset, *-omap: Avoid a GCC warning (regression 2020-10-10).Bruno Haible2020-10-181-1/+1
| | | | | | | | | | | | * lib/gl_anylinked_list2.h (gl_linked_iterator_free): Remove '_GL_ATTRIBUTE_CONST'. * lib/gl_anytree_list2.h (gl_tree_iterator_free): Likewise. * lib/gl_anytree_omap.h (gl_tree_iterator_free): Likewise. * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. * lib/gl_array_list.c (gl_array_iterator_free): Likewise. * lib/gl_array_omap.c (gl_array_iterator_free): Likewise. * lib/gl_array_oset.c (gl_array_iterator_free): Likewise. * lib/gl_carray_list.c (gl_carray_iterator_free): Likewise.
* *-list, *-oset, *-omap: Avoid possible compiler warnings.Bruno Haible2020-10-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Marc Nieper-Wißkirchen in <https://lists.gnu.org/r/bug-gnulib/2020-10/msg00025.html>. * lib/gl_anylinked_list2.h (gl_linked_iterator, gl_linked_iterator_from_to): Mark as 'pure'. (gl_linked_iterator_free): Mark as 'const'. * lib/gl_anytree_list2.h (gl_tree_size, gl_tree_node_value, gl_tree_search_from_to, gl_tree_indexof_from_to, gl_tree_iterator, gl_tree_iterator_from_to, gl_tree_sortedlist_search, gl_tree_sortedlist_search_from_to, gl_tree_sortedlist_indexof, gl_tree_sortedlist_indexof_from_to): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_omap.h (gl_tree_size, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_oset.h (gl_tree_size, gl_tree_next_node, gl_tree_prev_node, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytreehash_list1.h (node_position, compare_by_position, compare_position_threshold): Mark as 'pure'. * lib/gl_array_list.c (gl_array_size, gl_array_indexof_from_to, gl_array_search_from_to, gl_array_iterator, gl_array_iterator_from_to, gl_array_sortedlist_indexof_from_to, gl_array_sortedlist_indexof, gl_array_sortedlist_search_from_to, gl_array_sortedlist_search): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_omap.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_search_atleast, gl_array_iterator): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_oset.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_indexof_atleast, gl_array_search_atleast, gl_array_iterator, gl_array_iterator_atleast): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_carray_list.c (gl_carray_size, gl_carray_node_value, gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at, gl_carray_indexof_from_to, gl_carray_search_from_to, gl_carray_iterator, gl_carray_iterator_from_to, gl_carray_sortedlist_indexof_from_to, gl_carray_sortedlist_indexof, gl_carray_sortedlist_search_from_to, gl_carray_sortedlist_search): Mark as 'pure'. (gl_carray_iterator_free): Mark as 'const'.
* list: fix GCC warningsAkim Demaille2020-05-311-8/+10
| | | | | | | | | | | | | * lib/gl_anytree_list2.h (gl_tree_iterator_free) (gl_tree_next_node, gl_tree_node_nx_set_value) (gl_tree_previous_node, gl_tree_next_node): Mark unused arguments. * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. * lib/gl_anylinked_list2.h (gl_linked_node_value) (gl_linked_node_nx_set_value, gl_linked_iterator_free): Likewise. * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using the same variable name in nested scopes.
* list: Remove redundant code for remove_first and remove_last operations.Bruno Haible2020-05-021-62/+0
| | | | | | | | | | | | | | | | | * 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.
* list: Add remove_first and remove_last operations.Bruno Haible2020-05-021-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* Port to PGI 16.10 x86-64Paul Eggert2017-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | This patch fixes one real bug in gl_anylinked_list2.h, along with some minor glitches that are not bugs. It does not silence PGI’s thousands of bogus warnings when compiling test-intprops.c. Fortunately, the warnings do not cause a failure. * lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N): Rename parameter to avoid PGI warning about ‘#define f(n) 'n'’. My goodness, PGI goes back a long ways - this predates C89! * lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI. For example, ASYNCSAFE (const void *) should expand to ‘const void *volatile’, not to ‘volatile const void *’. * lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined. * lib/verify.h (verify) [!__GNUC__]: Use shorter albeit meaningless string to bypass silly compiler limits. * tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]: * tests/nan.h (NaNf, NaNd, NaNl): Use static functions to avoid misguided compiler diagnostics. Is there some reason we don’t use static functions on all platforms?
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* Use GCC_LINT, not lintPaul Eggert2016-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined. Problem reported by Ken Brown in: http://bugs.gnu.org/23640 * doc/posix-headers/stdnoreturn.texi (stdnoreturn.h): Document problem with lint and _Noreturn. * lib/diffseq.h (IF_LINT, IF_LINT2): * lib/fts.c (sccsid): * lib/getndelim2.c (IF_LINT): * lib/gl_anylinked_list2.h (gl_linked_iterator) (gl_linked_iterator_from_to): * lib/gl_anytree_list2.h (gl_tree_iterator) (gl_tree_iterator_from_to): * lib/gl_anytree_oset.h (gl_tree_iterator): * lib/gl_array_list.c (gl_array_iterator) (gl_array_iterator_from_to): * lib/gl_array_oset.c (gl_array_iterator): * lib/gl_carray_list.c (gl_carray_iterator) (gl_carray_iterator_from_to): * lib/idcache.c: * lib/inet_ntop.c (IF_LINT): * lib/regcomp.c (build_charclass_op, create_tree): * lib/regex_internal.c (re_acquire_state) (re_acquire_state_context): * lib/trigl.c (rcsid): * lib/trim.c (IF_LINT): * lib/vasnprintf.c (IF_LINT): * lib/verify.h (assume): Treat GCC_LINT like lint.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* linked-list, linkedhash-list: avoid compiler warningsPádraig Brady2015-06-191-11/+11
| | | | | * lib/gl_anytree_list2.h: Add _GL_ATTRIBUTE_PURE to avoid -Werror=suggest-attribute=pure (from GCC 5.1.1).
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* Move the malloc checking from module 'list' to new module 'xlist'.Bruno Haible2009-12-141-37/+151
|
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-289/+289
|
* New abstract list operation 'node_set_value'.Bruno Haible2008-02-101-1/+27
|
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* Allow the use of a destructor for the values stored in the list.Bruno Haible2007-03-161-1/+12
|
* More uses of XMALLOC, XNMALLOC and XCALLOC.Bruno Haible2006-11-071-21/+10
|
* Avoid using the variable name 'index' for two completely different things.Bruno Haible2006-10-101-6/+6
|
* Add bounded list search operations.Bruno Haible2006-10-061-0/+98
|
* Add searching operations, limited to a subsequence of the list.Bruno Haible2006-10-051-171/+258
|
* * gl_anylinked_list2.h [lint] (gl_linked_iterator)Ralf Wildenhues2006-09-221-0/+11
| | | | | | | | | | | | (gl_linked_iterator_from_to): Initialize struct completely. * gl_anytree_list2.h [lint] (gl_tree_iterator): Likewise. (gl_tree_iterator_from_to): Likewise * gl_anytree_oset.h [lint] (gl_tree_iterator): Likewise. * gl_array_list.c [lint] (gl_array_iterator) (gl_array_iterator_from_to): Likewise. * gl_array_oset.c [lint] (gl_array_iterator): Likewise. * gl_carray_list.c [lint] (gl_carray_iterator) (gl_carray_iterator_from_to): Likewise.
* Make it possible to use the list in signal-handlers.Bruno Haible2006-07-241-20/+37
|
* Common code several concrete list implementations.Bruno Haible2006-07-171-0/+843