diff --git a/engines/default/assoc.c b/engines/default/assoc.c index b38b23e9f..88b7c0cf4 100644 --- a/engines/default/assoc.c +++ b/engines/default/assoc.c @@ -36,9 +36,7 @@ #define DEFAULT_PREFIX_HASHPOWER 10 #define DEFAULT_PREFIX_MAX_DEPTH 1 -#ifdef VARIABLE_SIZED_ROOTTABLE #define DEFAULT_ROOTSIZE 512 -#endif typedef struct { prefix_t *pt; @@ -59,41 +57,29 @@ ENGINE_ERROR_CODE assoc_init(struct default_engine *engine) assoc->hashsize = hashsize(assoc->hashpower); assoc->hashmask = hashmask(assoc->hashpower); assoc->rootpower = 0; -#ifdef VARIABLE_SIZED_ROOTTABLE assoc->rootsize = DEFAULT_ROOTSIZE; - assoc->roottable = calloc(assoc->rootsize, sizeof(void *)); -#else - assoc->roottable = calloc(assoc->hashsize * 2, sizeof(void *)); -#endif + assoc->roottable = calloc(assoc->rootsize, sizeof(void *)); if (assoc->roottable == NULL) { return ENGINE_ENOMEM; } -#ifdef VARIABLE_SIZED_ROOTTABLE assoc->roottable[0].hashtable = calloc(assoc->hashsize, sizeof(void*)); if (assoc->roottable[0].hashtable == NULL) { free(assoc->roottable); return ENGINE_ENOMEM; } -#else - assoc->roottable[0].hashtable = (hash_item**)&assoc->roottable[assoc->hashsize]; -#endif assoc->infotable = calloc(assoc->hashsize, sizeof(struct bucket_info)); if (assoc->infotable == NULL) { -#ifdef VARIABLE_SIZED_ROOTTABLE free(assoc->roottable[0].hashtable); -#endif free(assoc->roottable); return ENGINE_ENOMEM; } assoc->prefix_hashtable = calloc(hashsize(DEFAULT_PREFIX_HASHPOWER), sizeof(void *)); if (assoc->prefix_hashtable == NULL) { -#ifdef VARIABLE_SIZED_ROOTTABLE free(assoc->roottable[0].hashtable); -#endif free(assoc->roottable); free(assoc->infotable); return ENGINE_ENOMEM; @@ -112,10 +98,7 @@ void assoc_final(struct default_engine *engine) struct assoc *assoc = &engine->assoc; int ii, table_count; -#ifdef VARIABLE_SIZED_ROOTTABLE free(assoc->roottable[0].hashtable); -#endif - for (ii=0; ii < assoc->rootpower; ++ii) { table_count = hashsize(ii); //2 ^ n free(assoc->roottable[table_count].hashtable); @@ -198,7 +181,6 @@ static void assoc_expand(struct default_engine *engine) hash_item** new_hashtable; uint32_t ii, table_count = hashsize(assoc->rootpower); // 2 ^ n -#ifdef VARIABLE_SIZED_ROOTTABLE if (table_count * 2 > assoc->rootsize) { struct table *reallocated_roottable = realloc(assoc->roottable, sizeof(void*) * assoc->rootsize * 2); if (reallocated_roottable == NULL) { @@ -207,7 +189,6 @@ static void assoc_expand(struct default_engine *engine) assoc->roottable = reallocated_roottable; assoc->rootsize *= 2; } -#endif new_hashtable = calloc(assoc->hashsize * table_count, sizeof(void *)); if (new_hashtable) { for (ii=0; ii < table_count; ++ii) { diff --git a/engines/default/assoc.h b/engines/default/assoc.h index bc52379d7..754a46cb3 100644 --- a/engines/default/assoc.h +++ b/engines/default/assoc.h @@ -58,9 +58,7 @@ struct assoc { uint32_t hashsize; /* hash table size */ uint32_t hashmask; /* hash bucket mask */ uint32_t rootpower; /* how many hash tables we use ? (power of 2) */ -#ifdef VARIABLE_SIZED_ROOTTABLE uint32_t rootsize; -#endif /* cache item hash table : an array of hash tables */ struct table { diff --git a/include/memcached/types.h b/include/memcached/types.h index d3b882423..5e12291ff 100644 --- a/include/memcached/types.h +++ b/include/memcached/types.h @@ -37,7 +37,6 @@ struct iovec { #define SUPPORT_BOP_MGET #define SUPPORT_BOP_SMGET #define JHPARK_OLD_SMGET_INTERFACE -#define VARIABLE_SIZED_ROOTTABLE #define MAX_EFLAG_COMPARE_COUNT 100