annotate lib/gl_linked_list.c @ 9309:bbbbbf4cd1c5

Change copyright notice from GPLv2+ to GPLv3+.
author Bruno Haible <bruno@clisp.org>
date Sun, 07 Oct 2007 19:14:58 +0200
parents 9704ff2cbdfe
children 25f7280c9cf0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Sequential list data type implemented by a linked list.
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2006 Free Software Foundation, Inc.
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2006.
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7410
diff changeset
5 This program is free software: you can redistribute it and/or modify
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7410
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7410
diff changeset
8 (at your option) any later version.
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7410
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
7304
1c4ed7637c24 Include <config.h> unconditionally.
Bruno Haible <bruno@clisp.org>
parents: 6978
diff changeset
18 #include <config.h>
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 /* Specification. */
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include "gl_linked_list.h"
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <stdlib.h>
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include "xalloc.h"
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 /* -------------------------- gl_list_t Data Type -------------------------- */
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 /* Generic linked list code. */
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #include "gl_anylinked_list1.h"
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 #include "gl_anylinked_list2.h"
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 const struct gl_list_implementation gl_linked_list_implementation =
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 {
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 gl_linked_create_empty,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 gl_linked_create,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 gl_linked_size,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 gl_linked_node_value,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 gl_linked_next_node,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 gl_linked_previous_node,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 gl_linked_get_at,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 gl_linked_set_at,
7405
0de49c40e105 Add searching operations, limited to a subsequence of the list.
Bruno Haible <bruno@clisp.org>
parents: 7304
diff changeset
44 gl_linked_search_from_to,
0de49c40e105 Add searching operations, limited to a subsequence of the list.
Bruno Haible <bruno@clisp.org>
parents: 7304
diff changeset
45 gl_linked_indexof_from_to,
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 gl_linked_add_first,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 gl_linked_add_last,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 gl_linked_add_before,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 gl_linked_add_after,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 gl_linked_add_at,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 gl_linked_remove_node,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 gl_linked_remove_at,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 gl_linked_remove,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 gl_linked_list_free,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 gl_linked_iterator,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 gl_linked_iterator_from_to,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 gl_linked_iterator_next,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 gl_linked_iterator_free,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 gl_linked_sortedlist_search,
7410
9704ff2cbdfe Add bounded list search operations.
Bruno Haible <bruno@clisp.org>
parents: 7405
diff changeset
60 gl_linked_sortedlist_search_from_to,
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 gl_linked_sortedlist_indexof,
7410
9704ff2cbdfe Add bounded list search operations.
Bruno Haible <bruno@clisp.org>
parents: 7405
diff changeset
62 gl_linked_sortedlist_indexof_from_to,
6978
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 gl_linked_sortedlist_add,
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 gl_linked_sortedlist_remove
ec26419f7c0b Sequential list data type implemented by a linked list.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 };