hash2.c revision 4e88cd0b7df2fd2ddc3ff80a6e0cef034072ab08
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "primes.h"
#include "hash2.h"
#define HASH_TABLE_MIN_SIZE 131
struct hash2_value {
struct hash2_value *next;
unsigned int key_hash;
/* user_data[value_size] */
};
struct hash2_table {
unsigned int count;
unsigned int initial_size;
unsigned int hash_table_size;
unsigned int value_size;
struct hash2_value *deleted_values;
void *context;
};
{
}
struct hash2_table *
{
struct hash2_table *hash;
return hash;
}
{
}
{
}
{
float nodes_per_list;
return;
return;
for (i = 0; i < old_count; i++) {
}
}
}
{
struct hash2_value *const *valuep;
struct hash2_value *value;
void *user_value;
return user_value;
}
}
return NULL;
}
{
struct hash2_value *const *valuep;
}
}
}
return NULL;
}
{
}
{
} else {
}
return value + 1;
}
static void
bool allow_resize)
{
struct hash2_value *deleted_value;
deleted_value = *valuep;
if (allow_resize)
}
{
struct hash2_value **valuep;
return;
}
}
i_panic("hash2_remove(): key not found");
}
{
/* don't allow resizing, otherwise iterating would
break completely */
return;
}
}
}
{
}