diff PrivateHash.c @ 4:1ee100564408

Changed malloc and free to VMS__malloc and VMS__free
author Me
date Sun, 31 Oct 2010 20:25:30 -0700
parents e6fe47763ee6
children e072db5aa783
line diff
     1.1 --- a/PrivateHash.c	Sat Sep 11 07:57:41 2010 -0700
     1.2 +++ b/PrivateHash.c	Sun Oct 31 20:25:30 2010 -0700
     1.3 @@ -18,11 +18,11 @@
     1.4   HashTable *
     1.5  makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn )
     1.6   { HashTable * retTable;
     1.7 -   retTable = malloc( sizeof( HashTable ) );
     1.8 +   retTable = VMS__malloc( sizeof( HashTable ) );
     1.9  
    1.10     retTable->freeEntryContentFn = freeFn;
    1.11     
    1.12 -   retTable->entries    = malloc( numHashSlots * sizeof(HashEntry *) );
    1.13 +   retTable->entries    = VMS__malloc( numHashSlots * sizeof(HashEntry *) );
    1.14     retTable->numEntries = 0;
    1.15     retTable->tableSz    = numHashSlots;
    1.16  
    1.17 @@ -40,7 +40,7 @@
    1.18     oldEntries = table->entries;
    1.19  
    1.20     newTableSz = 2 * oldTableSz + 1;
    1.21 -   newEntries = malloc( newTableSz * sizeof(HashEntry *) );
    1.22 +   newEntries = VMS__malloc( newTableSz * sizeof(HashEntry *) );
    1.23  
    1.24     table->tableSz    = newTableSz;
    1.25     table->entries    = newEntries;
    1.26 @@ -112,7 +112,7 @@
    1.27     hashEntry = getEntryFromTable( key, table );
    1.28     if( hashEntry == NULL )
    1.29      { hashIdx = hashThisKey( key, table->tableSz );
    1.30 -      hashEntry = (HashEntry*) malloc( sizeof( HashEntry ) );
    1.31 +      hashEntry = (HashEntry*) VMS__malloc( sizeof( HashEntry ) );
    1.32              if( hashEntry == NULL )  return 0;
    1.33        hashEntry->key = strdup( key ); //TODO: figure out soln for incr Sz
    1.34              if( hashEntry->key == NULL ) return 0;
    1.35 @@ -232,14 +232,14 @@
    1.36   {
    1.37     if( entry->content != NULL )
    1.38        (*(table->freeEntryContentFn))( entry->content );
    1.39 -   free( entry->key ); //was malloc'd above, so free it
    1.40 -   free( entry );
    1.41 +   VMS__free( entry->key ); //was VMS__malloc'd above, so free it
    1.42 +   VMS__free( entry );
    1.43   }
    1.44  
    1.45  void
    1.46  freeHashEntryButNotContent( HashEntry *entry )
    1.47   {
    1.48 -   free( entry->key ); //was malloc'd above, so free it
    1.49 -   free( entry );
    1.50 +   VMS__free( entry->key ); //was VMS__malloc'd above, so free it
    1.51 +   VMS__free( entry );
    1.52   }
    1.53