comparison PrivateHash.c @ 10:ce35f7028eba

Closing branch
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 28 Sep 2011 13:40:38 +0200
parents e072db5aa783
children
comparison
equal deleted inserted replaced
4:5de93c6d80b3 7:204118d5a88b
112 hashEntry = getEntryFromTable( key, table ); 112 hashEntry = getEntryFromTable( key, table );
113 if( hashEntry == NULL ) 113 if( hashEntry == NULL )
114 { hashIdx = hashThisKey( key, table->tableSz ); 114 { hashIdx = hashThisKey( key, table->tableSz );
115 hashEntry = (HashEntry*) VMS__malloc( sizeof( HashEntry ) ); 115 hashEntry = (HashEntry*) VMS__malloc( sizeof( HashEntry ) );
116 if( hashEntry == NULL ) return 0; 116 if( hashEntry == NULL ) return 0;
117 hashEntry->key = VMS__malloc( strlen(key) ); 117 hashEntry->key = VMS__strDup( key );
118 if( hashEntry->key == NULL ) return 0;
119 strcpy( hashEntry->key, key );
120 hashEntry->next = (table->entries)[hashIdx]; 118 hashEntry->next = (table->entries)[hashIdx];
121 (table->entries)[hashIdx] = hashEntry; 119 (table->entries)[hashIdx] = hashEntry;
122 table->numEntries += 1; 120 table->numEntries += 1;
123 if( table->tableSz < table->numEntries ) doubleTableSize( table ); 121 if( table->tableSz < table->numEntries ) doubleTableSize( table );
124 } 122 }