104 |
static SCM |
static SCM |
105 |
make_hash_table (int flags, unsigned long k, const char *func_name) { |
make_hash_table (int flags, unsigned long k, const char *func_name) { |
106 |
SCM table, vector; |
SCM table, vector; |
107 |
int i, n = k ? k : 31; |
int i = 0, n = k ? k : 31; |
108 |
|
while (i < HASHTABLE_SIZE_N && n > hashtable_size[i]) |
109 |
|
++i; |
110 |
|
n = hashtable_size[i]; |
111 |
if (flags) |
if (flags) |
112 |
/* The SCM_WVECTF_NOSCAN flag informs the weak vector code not to |
/* The SCM_WVECTF_NOSCAN flag informs the weak vector code not to |
113 |
perform the final scan for broken references. Instead we do |
perform the final scan for broken references. Instead we do |
119 |
else |
else |
120 |
vector = scm_c_make_vector (n, SCM_EOL); |
vector = scm_c_make_vector (n, SCM_EOL); |
121 |
scm_t_hashtable *t = scm_gc_malloc (sizeof (*t), s_hashtable); |
scm_t_hashtable *t = scm_gc_malloc (sizeof (*t), s_hashtable); |
|
i = 0; |
|
|
while (i < HASHTABLE_SIZE_N && n > hashtable_size[i]) |
|
|
++i; |
|
|
if (i > 0) |
|
|
i = i - 1; |
|
122 |
t->min_size_index = t->size_index = i; |
t->min_size_index = t->size_index = i; |
123 |
t->n_items = 0; |
t->n_items = 0; |
124 |
t->lower = 0; |
t->lower = 0; |
125 |
t->upper = 9 * hashtable_size[i] / 10; |
t->upper = 9 * n / 10; |
126 |
t->flags = flags; |
t->flags = flags; |
127 |
if (flags) |
if (flags) |
128 |
{ |
{ |