/[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.1 by gary, Sun Sep 2 09:05:14 2001 UTC revision 1.2 by gary, Sat Sep 8 02:13:17 2001 UTC
# Line 21  Line 21 
21  /* TODO:  /* TODO:
22     - Use an obstack to manage the node memory.     - Use an obstack to manage the node memory.
23     - Implement the macroized magic values with the API.     - Implement the macroized magic values with the API.
    - Have each node be a pushdown stack to eliminate the shadowed flag.  
24   */   */
25    
26  #include "hash.h"  #include "hash.h"
# Line 343  m4_hash_maybe_grow (m4_hash *hash) Line 342  m4_hash_maybe_grow (m4_hash *hash)
342      }      }
343  }  }
344    
345  /* Carefully insert each node in BUCKET into HASH.  The nodes are  /* Insert each node in BUCKET into HASH.  Relative ordering of nodes
346     inserted in reverse order to preserve the relative ordering of     is not preserved.  */
    all sets of nodes with the same key.  */  
347  void  void
348  m4_hash_bucket_insert (m4_hash *hash, m4_hash_node *bucket)  m4_hash_bucket_insert (m4_hash *hash, m4_hash_node *bucket)
349  {  {
350    assert (hash);    assert (hash);
351    assert (bucket);    assert (bucket);
352    
353    if (M4_HASH_NODE_NEXT (bucket))    do
354      {      {
355        /* Recurse to the end of the list.  */        m4_hash_node *next = M4_HASH_NODE_NEXT (bucket);
       m4_hash_bucket_insert (hash, M4_HASH_NODE_NEXT (bucket));  
356    
357        /* Break links as the stack unwinds.  */        /* Break link to rest of the bucket before reinserting.  */
358        M4_HASH_NODE_NEXT (bucket) = 0;        M4_HASH_NODE_NEXT (bucket) = 0;
359      }        m4_hash_node_insert (hash, bucket);
360    
361    /* Insert each node, from last to first, as the stack unwinds.  */        bucket = next;
362    m4_hash_node_insert (hash, bucket);      }
363      while (bucket);
364  }  }
365    
366    

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

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