IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1413


Ignore:
Timestamp:
Aug 6, 2004, 2:33:36 PM (22 years ago)
Author:
desonia
Message:

fixed hashFree as to free all the buckets manually instead of relying on hashBucketFree, as that is used in item removal (which shouldn't go off deleting the next bucket).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sysUtils/psHash.c

    r1407 r1413  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-07 00:06:06 $
     13*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-07 00:33:36 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    119119        return;
    120120    }
    121     // A bucket is actually a linked list of buckets.  We recursively step
    122     // through that linked list, free each bucket.
    123     psFree(bucket->next);
    124121
    125122    psFree(bucket->key);
     
    183180
    184181        // A bucket is composed of a linked list of buckets.
    185         if (table->buckets[i] != NULL) {
    186             psFree(table->buckets[i]);
     182        while (table->buckets[i] != NULL) {
     183            psHashBucket* bucket = table->buckets[i];
     184            table->buckets[i] = bucket->next;
     185            psFree(bucket);
    187186        }
    188187    }
     
    263262            optr = ptr;
    264263            while (ptr != NULL) {
    265                 // Dtermine if this entry holds the correct key.
     264                // Determine if this entry holds the correct key.
    266265                if (strcmp(key, ptr->key) == 0) {
    267266                    // The following lines of code are fairly standard ways
     
    274273                        table->buckets[hash] = ptr->next;
    275274                    }
    276 
    277275                    psFree(ptr);
    278276
Note: See TracChangeset for help on using the changeset viewer.