1 /* Sequential list data type implemented by a linked list.
2    Copyright (C) 2006, 2009-2020 Free Software Foundation, Inc.
3    Written by Bruno Haible <bruno@clisp.org>, 2006.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 /* Common code of gl_linked_list.c and gl_linkedhash_list.c.  */
19 
20 /* -------------------------- gl_list_t Data Type -------------------------- */
21 
22 /* Concrete list node implementation, valid for this file only.  */
23 struct gl_list_node_impl
24 {
25 #if WITH_HASHTABLE
26   struct gl_hash_entry h;           /* hash table entry fields; must be first */
27 #endif
28   struct gl_list_node_impl *next;
29   struct gl_list_node_impl *prev;
30   const void *value;
31 };
32 
33 /* Concrete gl_list_impl type, valid for this file only.  */
34 struct gl_list_impl
35 {
36   struct gl_list_impl_base base;
37 #if WITH_HASHTABLE
38   /* A hash table: managed as an array of collision lists.  */
39   struct gl_hash_entry **table;
40   size_t table_size;
41 #endif
42   /* A circular list anchored at root.
43      The first node is = root.next, the last node is = root.prev.
44      The root's value is unused.  */
45   struct gl_list_node_impl root;
46   /* Number of list nodes, excluding the root.  */
47   size_t count;
48 };
49