Mercurial > gnulib
annotate lib/gl_anyhash_list2.h @ 17363:5a51fb7777a9
sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Problem reported by Marco Atzeri in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
* lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
Simply delegate to the system <sys/select.h> in this case too.
Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
be needed on Solaris either.
* lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
Simply delgate to the system <sys/time.h> in this case.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 19 Mar 2013 09:08:47 -0700 |
parents | e542fd46ad6f |
children | 344018b6e5d7 |
rev | line source |
---|---|
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Sequential list data type implemented by a hash table with another list. |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
16201
diff
changeset
|
2 Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 Written by Bruno Haible <bruno@clisp.org>, 2006. |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7615
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
6973
de9a21fc207a
Common code several concrete list implementations.
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:
7615
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:
7615
diff
changeset
|
8 (at your option) any later version. |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
de9a21fc207a
Common code several concrete list implementations.
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:
7615
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 /* Common code of |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 /* Array of primes, approximately in steps of factor 1.2. |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 This table was computed by executing the Common Lisp expression |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 (dotimes (i 244) (format t "nextprime(~D)~%" (ceiling (expt 1.2d0 i)))) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 and feeding the result to PARI/gp. */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 static const size_t primes[] = |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 { |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 11, 13, 17, 19, 23, 29, 37, 41, 47, 59, 67, 83, 97, 127, 139, 167, 199, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 239, 293, 347, 419, 499, 593, 709, 853, 1021, 1229, 1471, 1777, 2129, 2543, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 3049, 3659, 4391, 5273, 6323, 7589, 9103, 10937, 13109, 15727, 18899, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 22651, 27179, 32609, 39133, 46957, 56359, 67619, 81157, 97369, 116849, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 140221, 168253, 201907, 242309, 290761, 348889, 418667, 502409, 602887, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 723467, 868151, 1041779, 1250141, 1500181, 1800191, 2160233, 2592277, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 3110741, 3732887, 4479463, 5375371, 6450413, 7740517, 9288589, 11146307, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 13375573, 16050689, 19260817, 23112977, 27735583, 33282701, 39939233, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 47927081, 57512503, 69014987, 82818011, 99381577, 119257891, 143109469, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 171731387, 206077643, 247293161, 296751781, 356102141, 427322587, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 512787097, 615344489, 738413383, 886096061, 1063315271, 1275978331, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 1531174013, 1837408799, 2204890543UL, 2645868653UL, 3175042391UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 3810050851UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 #if SIZE_MAX > 4294967295UL |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 4572061027UL, 5486473229UL, 6583767889UL, 7900521449UL, 9480625733UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 11376750877UL, 13652101063UL, 16382521261UL, 19659025513UL, 23590830631UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 28308996763UL, 33970796089UL, 40764955463UL, 48917946377UL, 58701535657UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 70441842749UL, 84530211301UL, 101436253561UL, 121723504277UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 146068205131UL, 175281846149UL, 210338215379UL, 252405858521UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 302887030151UL, 363464436191UL, 436157323417UL, 523388788231UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 628066545713UL, 753679854847UL, 904415825857UL, 1085298991109UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 1302358789181UL, 1562830547009UL, 1875396656429UL, 2250475987709UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 2700571185239UL, 3240685422287UL, 3888822506759UL, 4666587008147UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 5599904409713UL, 6719885291641UL, 8063862349969UL, 9676634819959UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 11611961783951UL, 13934354140769UL, 16721224968907UL, 20065469962669UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 24078563955191UL, 28894276746229UL, 34673132095507UL, 41607758514593UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 49929310217531UL, 59915172260971UL, 71898206713183UL, 86277848055823UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 103533417666967UL, 124240101200359UL, 149088121440451UL, 178905745728529UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 214686894874223UL, 257624273849081UL, 309149128618903UL, 370978954342639UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 445174745211143UL, 534209694253381UL, 641051633104063UL, 769261959724877UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 923114351670013UL, 1107737222003791UL, 1329284666404567UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 1595141599685509UL, 1914169919622551UL, 2297003903547091UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 2756404684256459UL, 3307685621107757UL, 3969222745329323UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 4763067294395177UL, 5715680753274209UL, 6858816903929113UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 8230580284714831UL, 9876696341657791UL, 11852035609989371UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 14222442731987227UL, 17066931278384657UL, 20480317534061597UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 24576381040873903UL, 29491657249048679UL, 35389988698858471UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 42467986438630267UL, 50961583726356109UL, 61153900471627387UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 73384680565952851UL, 88061616679143347UL, 105673940014972061UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 126808728017966413UL, 152170473621559703UL, 182604568345871671UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 219125482015045997UL, 262950578418055169UL, 315540694101666193UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 378648832921999397UL, 454378599506399233UL, 545254319407679131UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 654305183289214771UL, 785166219947057701UL, 942199463936469157UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 1130639356723763129UL, 1356767228068515623UL, 1628120673682218619UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 1953744808418662409UL, 2344493770102394881UL, 2813392524122873857UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 3376071028947448339UL, 4051285234736937517UL, 4861542281684325481UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 5833850738021191727UL, 7000620885625427969UL, 8400745062750513217UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 10080894075300616261UL, 12097072890360739951UL, 14516487468432885797UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 17419784962119465179UL, |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 #endif |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 SIZE_MAX /* sentinel, to ensure the search terminates */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 }; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 /* Return a suitable prime >= ESTIMATE. */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 static size_t |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 next_prime (size_t estimate) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 { |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 size_t i; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 for (i = 0; i < sizeof (primes) / sizeof (primes[0]); i++) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 if (primes[i] >= estimate) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 return primes[i]; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 return SIZE_MAX; /* not a prime, but better than nothing */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 } |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 /* Resize the hash table with a new estimated size. */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 static void |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 hash_resize (gl_list_t list, size_t estimate) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 { |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 size_t new_size = next_prime (estimate); |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 if (new_size > list->table_size) |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 { |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 gl_hash_entry_t *old_table = list->table; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 /* Allocate the new table. */ |
12445
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
102 gl_hash_entry_t *new_table; |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 size_t i; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 |
12445
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
105 if (size_overflow_p (xtimes (new_size, sizeof (gl_hash_entry_t)))) |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
106 goto fail; |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
107 new_table = |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
108 (gl_hash_entry_t *) calloc (new_size, sizeof (gl_hash_entry_t)); |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
109 if (new_table == NULL) |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
110 goto fail; |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
111 |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 /* Iterate through the entries of the old table. */ |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 for (i = list->table_size; i > 0; ) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
114 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
115 gl_hash_entry_t node = old_table[--i]; |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
117 while (node != NULL) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
118 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
119 gl_hash_entry_t next = node->hash_next; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
120 /* Add the entry to the new table. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
121 size_t bucket = node->hashcode % new_size; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
122 node->hash_next = new_table[bucket]; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
123 new_table[bucket] = node; |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
124 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
125 node = next; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
126 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
127 } |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
128 |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
129 list->table = new_table; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
130 list->table_size = new_size; |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
131 free (old_table); |
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
132 } |
12445
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
133 return; |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
134 |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
135 fail: |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
136 /* Just continue without resizing the table. */ |
a8c91b846640
Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
137 return; |
6973
de9a21fc207a
Common code several concrete list implementations.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
138 } |