/[m4]/m4/m4/hash.c
ViewVC logotype

Diff of /m4/m4/hash.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gary, Sat Sep 8 02:13:17 2001 UTC revision 1.3 by gary, Thu Sep 20 03:48:05 2001 UTC
# Line 271  m4_hash_remove (m4_hash *hash, const voi Line 271  m4_hash_remove (m4_hash *hash, const voi
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  {  {
# Line 363  m4_hash_bucket_insert (m4_hash *hash, m4 Line 364  m4_hash_bucket_insert (m4_hash *hash, m4
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
# Line 448  m4_hash_iterator_key (m4_hash_iterator * Line 460  m4_hash_iterator_key (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  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26