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 distinguihed from a failed lookup |
an explicit 0 value can be distinguished from a failed lookup |
275 |
(also 0). */ |
(also 0). Fortuitously for M4, this also means that the value |
276 |
|
field can be changed `in situ' to implement a value stack. */ |
277 |
void ** |
void ** |
278 |
m4_hash_lookup (m4_hash *hash, const void *key) |
m4_hash_lookup (m4_hash *hash, const void *key) |
279 |
{ |
{ |
364 |
while (bucket); |
while (bucket); |
365 |
} |
} |
366 |
|
|
367 |
|
void |
368 |
|
m4_hash_exit (void) |
369 |
|
{ |
370 |
|
while (m4_hash_node_free_list) |
371 |
|
{ |
372 |
|
m4_hash_node *stale = m4_hash_node_free_list; |
373 |
|
m4_hash_node_free_list = M4_HASH_NODE_NEXT (stale); |
374 |
|
xfree (stale); |
375 |
|
} |
376 |
|
} |
377 |
|
|
378 |
|
|
379 |
|
|
380 |
struct m4_hash_iterator |
struct m4_hash_iterator |
460 |
return M4_HASH_NODE_KEY (M4_ITERATOR_PLACE (place)); |
return M4_HASH_NODE_KEY (M4_ITERATOR_PLACE (place)); |
461 |
} |
} |
462 |
|
|
463 |
void * |
void ** |
464 |
m4_hash_iterator_value (m4_hash_iterator *place) |
m4_hash_iterator_value (m4_hash_iterator *place) |
465 |
{ |
{ |
466 |
assert (place); |
assert (place); |
467 |
|
|
468 |
return M4_HASH_NODE_VAL (M4_ITERATOR_PLACE (place)); |
return &M4_HASH_NODE_VAL (M4_ITERATOR_PLACE (place)); |
469 |
} |
} |