Remove the leafkey NULL check in leaf_elm_lookup.

This commit is contained in:
Qi Wang 2017-03-28 17:14:43 -07:00 committed by Qi Wang
parent 9ed84b0d45
commit 51d3682950
2 changed files with 10 additions and 14 deletions

View File

@ -324,20 +324,16 @@ rtree_leaf_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
#define RTREE_CACHE_CHECK(i) do { \
if (likely(rtree_ctx->cache[i].leafkey == leafkey)) { \
rtree_leaf_elm_t *leaf = rtree_ctx->cache[i].leaf; \
if (likely(leaf != NULL)) { \
/* Bubble up by one. */ \
assert(leaf != NULL); \
if (i > 0) { \
rtree_ctx->cache[i] = \
rtree_ctx->cache[i - 1]; \
rtree_ctx->cache[i - 1].leafkey = \
leafkey; \
/* Bubble up by one. */ \
rtree_ctx->cache[i] = rtree_ctx->cache[i - 1]; \
rtree_ctx->cache[i - 1].leafkey = leafkey; \
rtree_ctx->cache[i - 1].leaf = leaf; \
} \
uintptr_t subkey = rtree_subkey(key, \
RTREE_HEIGHT-1); \
uintptr_t subkey = rtree_subkey(key, RTREE_HEIGHT-1); \
return &leaf[subkey]; \
} \
} \
} while (0)
/* Check the first cache entry. */
RTREE_CACHE_CHECK(0);