Mercurial > hg > octave-nkf > gnulib-hg
comparison lib/gl_anylinked_list1.h @ 6973:de9a21fc207a
Common code several concrete list implementations.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 17 Jul 2006 11:27:18 +0000 |
parents | |
children | bbbbbf4cd1c5 |
comparison
equal
deleted
inserted
replaced
6972:1708033b9e1f | 6973:de9a21fc207a |
---|---|
1 /* Sequential list data type implemented by a linked list. | |
2 Copyright (C) 2006 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 2, or (at your option) | |
8 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, write to the Free Software Foundation, | |
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | |
19 /* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ | |
20 | |
21 /* -------------------------- gl_list_t Data Type -------------------------- */ | |
22 | |
23 /* Concrete list node implementation, valid for this file only. */ | |
24 struct gl_list_node_impl | |
25 { | |
26 #if WITH_HASHTABLE | |
27 struct gl_hash_entry h; /* hash table entry fields; must be first */ | |
28 #endif | |
29 struct gl_list_node_impl *next; | |
30 struct gl_list_node_impl *prev; | |
31 const void *value; | |
32 }; | |
33 | |
34 /* Concrete gl_list_impl type, valid for this file only. */ | |
35 struct gl_list_impl | |
36 { | |
37 struct gl_list_impl_base base; | |
38 #if WITH_HASHTABLE | |
39 /* A hash table: managed as an array of collision lists. */ | |
40 struct gl_hash_entry **table; | |
41 size_t table_size; | |
42 #endif | |
43 /* A circular list anchored at root. | |
44 The first node is = root.next, the last node is = root.prev. | |
45 The root's value is unused. */ | |
46 struct gl_list_node_impl root; | |
47 /* Number of list nodes, excluding the root. */ | |
48 size_t count; | |
49 }; |