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 { \ #define RTREE_CACHE_CHECK(i) do { \
if (likely(rtree_ctx->cache[i].leafkey == leafkey)) { \ if (likely(rtree_ctx->cache[i].leafkey == leafkey)) { \
rtree_leaf_elm_t *leaf = rtree_ctx->cache[i].leaf; \ rtree_leaf_elm_t *leaf = rtree_ctx->cache[i].leaf; \
if (likely(leaf != NULL)) { \ assert(leaf != NULL); \
/* Bubble up by one. */ \
if (i > 0) { \ if (i > 0) { \
rtree_ctx->cache[i] = \ /* Bubble up by one. */ \
rtree_ctx->cache[i - 1]; \ rtree_ctx->cache[i] = rtree_ctx->cache[i - 1]; \
rtree_ctx->cache[i - 1].leafkey = \ rtree_ctx->cache[i - 1].leafkey = leafkey; \
leafkey; \
rtree_ctx->cache[i - 1].leaf = leaf; \ rtree_ctx->cache[i - 1].leaf = leaf; \
} \ } \
uintptr_t subkey = rtree_subkey(key, \ uintptr_t subkey = rtree_subkey(key, RTREE_HEIGHT-1); \
RTREE_HEIGHT-1); \
return &leaf[subkey]; \ return &leaf[subkey]; \
} \ } \
} \
} while (0) } while (0)
/* Check the first cache entry. */ /* Check the first cache entry. */
RTREE_CACHE_CHECK(0); RTREE_CACHE_CHECK(0);