From 99f2454646034d3e4ef876be2c2001abe60ad8af Mon Sep 17 00:00:00 2001 From: William Irwin Date: Mon, 26 Mar 2012 23:36:35 +0000 Subject: [PATCH] Manually convert tail recursion to iteration in ck_ht_grow_spmc(). Signed-off-by: Samy Al Bahra --- src/ck_ht.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ck_ht.c b/src/ck_ht.c index 0cba532..db53f68 100644 --- a/src/ck_ht.c +++ b/src/ck_ht.c @@ -338,6 +338,7 @@ ck_ht_grow_spmc(ck_ht_t *table, uint64_t capacity) size_t k, i, j, offset; uint64_t probes; +restart: map = table->map; if (map->capacity >= capacity) @@ -398,7 +399,8 @@ ck_ht_grow_spmc(ck_ht_t *table, uint64_t capacity) * larger. */ ck_ht_map_destroy(update, false); - return ck_ht_grow_spmc(table, capacity << 1); + capacity <<= 1; + goto restart; } }