hashTable->head[i] = NULL;
hashTable->size = 0;
}
HashTable* _hashtable_new(size_t dataSize, size_t hashSize)
{
hashTable->head[i] = NULL;
hashTable->size = 0;
}
HashTable* _hashtable_new(size_t dataSize, size_t hashSize)
{
- HashTable* hashTable = (HashTable*) safe_malloc(sizeof (HashTable));
- _hashtable_init(hashTable, dataSize, hashSize);
- return hashTable;
+ HashTable* hashTable = (HashTable*) safe_malloc(sizeof (HashTable));
+ _hashtable_init(hashTable, dataSize, hashSize);
+ return hashTable;
HashCell *cell = hashTable->head[i],
*cellCopy = hashTableCopy->head[i],
*prev = NULL;
HashCell *cell = hashTable->head[i],
*cellCopy = hashTableCopy->head[i],
*prev = NULL;
- cellCopy->data = safe_malloc(hashTable->dataSize);
- memcpy(cellCopy->data, cell->data, hashTable->dataSize);
+ cellCopy->data = safe_malloc(hashTable->dataSize);
+ memcpy(cellCopy->data, cell->data, hashTable->dataSize);
if (prev == NULL) hashTableCopy->head[i] = cellCopy;
else prev->next = cellCopy;
prev = cellCopy;
cell = cell->next;
}
if (cellCopy != NULL) cellCopy->next = NULL;
if (prev == NULL) hashTableCopy->head[i] = cellCopy;
else prev->next = cellCopy;
prev = cellCopy;
cell = cell->next;
}
if (cellCopy != NULL) cellCopy->next = NULL;