const char *new_string, int new_index,
char **strings) {
- unsigned int code = 0;
+ unsigned int code = 0, start;
int k;
/* This is my recipe. I checked, it seems to work (as long as
}
code = code % hash_table->size;
+ start = code;
while(hash_table->entries[code] >= 0) {
/* There is a string with that code */
/* This collision was not the same string, let's move to the next
in the table */
code = (code + 1) % hash_table->size;
+ /* We came back to our original code, which means that the table
+ is full */
+ if(code == start) {
+ printf("Full hash table (that should not happen)\n");
+ exit(EXIT_FAILURE);
+ }
}
/* This string was not already in there, store the index in the