271 |
|
|
272 |
/* Return the address of the value field of the first node in |
/* Return the address of the value field of the first node in |
273 |
HASH that has a matching KEY. The address is returned so that |
HASH that has a matching KEY. The address is returned so that |
274 |
an explicit 0 value can be distinguished from a failed lookup |
an explicit 0 value can be distinguihed from a failed lookup |
275 |
(also 0). Fortuitously for M4, this also means that the value |
(also 0). */ |
|
field can be changed `in situ' to implement a value stack. */ |
|
276 |
void ** |
void ** |
277 |
m4_hash_lookup (m4_hash *hash, const void *key) |
m4_hash_lookup (m4_hash *hash, const void *key) |
278 |
{ |
{ |
363 |
while (bucket); |
while (bucket); |
364 |
} |
} |
365 |
|
|
|
void |
|
|
m4_hash_exit (void) |
|
|
{ |
|
|
while (m4_hash_node_free_list) |
|
|
{ |
|
|
m4_hash_node *stale = m4_hash_node_free_list; |
|
|
m4_hash_node_free_list = M4_HASH_NODE_NEXT (stale); |
|
|
xfree (stale); |
|
|
} |
|
|
} |
|
|
|
|
366 |
|
|
367 |
|
|
368 |
struct m4_hash_iterator |
struct m4_hash_iterator |
448 |
return M4_HASH_NODE_KEY (M4_ITERATOR_PLACE (place)); |
return M4_HASH_NODE_KEY (M4_ITERATOR_PLACE (place)); |
449 |
} |
} |
450 |
|
|
451 |
void ** |
void * |
452 |
m4_hash_iterator_value (m4_hash_iterator *place) |
m4_hash_iterator_value (m4_hash_iterator *place) |
453 |
{ |
{ |
454 |
assert (place); |
assert (place); |
455 |
|
|
456 |
return &M4_HASH_NODE_VAL (M4_ITERATOR_PLACE (place)); |
return M4_HASH_NODE_VAL (M4_ITERATOR_PLACE (place)); |
457 |
} |
} |