[BACK]Return to hash.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/Attic/hash.c between version 1.2 and 1.3

version 1.2, 1996/06/26 05:36:31 version 1.3, 1996/11/30 21:08:55
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: hash.c,v 1.5 1995/06/14 15:19:15 christos Exp $        */  /*      $NetBSD: hash.c,v 1.6 1996/11/06 17:59:06 christos Exp $        */
   
 /*  /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.   * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
Line 41 
Line 41 
   
 #ifndef lint  #ifndef lint
 #if 0  #if 0
 static char sccsid[] = "@(#)hash.c      5.5 (Berkeley) 12/28/90";  static char sccsid[] = "@(#)hash.c      8.1 (Berkeley) 6/6/93";
 #else  #else
 static char rcsid[] = "$OpenBSD$";  static char rcsid[] = "$OpenBSD$";
 #endif  #endif
Line 65 
Line 65 
   
 static void RebuildTable __P((Hash_Table *));  static void RebuildTable __P((Hash_Table *));
   
 /*  /*
  * The following defines the ratio of # entries to # buckets   * The following defines the ratio of # entries to # buckets
  * at which we rebuild the table to make it larger.   * at which we rebuild the table to make it larger.
  */   */
Line 74 
Line 74 
   
 /*  /*
  *---------------------------------------------------------   *---------------------------------------------------------
  *   *
  * Hash_InitTable --   * Hash_InitTable --
  *   *
  *      This routine just sets up the hash table.   *      This routine just sets up the hash table.
  *   *
  * Results:   * Results:
  *      None.   *      None.
  *   *
  * Side Effects:   * Side Effects:
Line 101 
Line 101 
         register struct Hash_Entry **hp;          register struct Hash_Entry **hp;
   
         /*          /*
          * Round up the size to a power of two.           * Round up the size to a power of two.
          */           */
         if (numBuckets <= 0)          if (numBuckets <= 0)
                 i = 16;                  i = 16;
Line 126 
Line 126 
  *      and frees up the memory space it occupied (except for   *      and frees up the memory space it occupied (except for
  *      the space in the Hash_Table structure).   *      the space in the Hash_Table structure).
  *   *
  * Results:   * Results:
  *      None.   *      None.
  *   *
  * Side Effects:   * Side Effects:
Line 152 
Line 152 
   
         /*          /*
          * Set up the hash table to cause memory faults on any future access           * Set up the hash table to cause memory faults on any future access
          * attempts until re-initialization.           * attempts until re-initialization.
          */           */
         t->bucketPtr = NULL;          t->bucketPtr = NULL;
 }  }
Line 244 
Line 244 
         /*          /*
          * The desired entry isn't there.  Before allocating a new entry,           * The desired entry isn't there.  Before allocating a new entry,
          * expand the table if necessary (and this changes the resulting           * expand the table if necessary (and this changes the resulting
          * bucket chain).           * bucket chain).
          */           */
         if (t->numEntries >= rebuildLimit * t->size)          if (t->numEntries >= rebuildLimit * t->size)
                 RebuildTable(t);                  RebuildTable(t);
Line 308 
Line 308 
  *      This procedure sets things up for a complete search   *      This procedure sets things up for a complete search
  *      of all entries recorded in the hash table.   *      of all entries recorded in the hash table.
  *   *
  * Results:   * Results:
  *      The return value is the address of the first entry in   *      The return value is the address of the first entry in
  *      the hash table, or NULL if the table is empty.   *      the hash table, or NULL if the table is empty.
  *   *
Line 323 
Line 323 
 Hash_Entry *  Hash_Entry *
 Hash_EnumFirst(t, searchPtr)  Hash_EnumFirst(t, searchPtr)
         Hash_Table *t;                  /* Table to be searched. */          Hash_Table *t;                  /* Table to be searched. */
         register Hash_Search *searchPtr;/* Area in which to keep state          register Hash_Search *searchPtr;/* Area in which to keep state
                                          * about search.*/                                           * about search.*/
 {  {
         searchPtr->tablePtr = t;          searchPtr->tablePtr = t;
Line 352 
Line 352 
   
 Hash_Entry *  Hash_Entry *
 Hash_EnumNext(searchPtr)  Hash_EnumNext(searchPtr)
         register Hash_Search *searchPtr; /* Area used to keep state about          register Hash_Search *searchPtr; /* Area used to keep state about
                                             search. */                                              search. */
 {  {
         register Hash_Entry *e;          register Hash_Entry *e;
Line 386 
Line 386 
  *      This local routine makes a new hash table that   *      This local routine makes a new hash table that
  *      is larger than the old one.   *      is larger than the old one.
  *   *
  * Results:   * Results:
  *      None.   *      None.
  *   *
  * Side Effects:   * Side Effects:

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