From: Vladimir Davydov <vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org Subject: [PATCH v2 4/7] vinyl: zap vy_mem_iterator_curr_stmt helper Date: Sat, 6 Apr 2019 23:01:51 +0300 [thread overview] Message-ID: <2eedfbd806c2c06ae2f169fdc1239ac21070ebd6.1554580275.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1554580275.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1554580275.git.vdavydov.dev@gmail.com> It's a trivial one-line function, which can be folded without hurting readability, i.e. it only obfuscates the code. Let's kill it. --- src/box/vy_mem.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/box/vy_mem.c b/src/box/vy_mem.c index dc1401ad..ad74e419 100644 --- a/src/box/vy_mem.c +++ b/src/box/vy_mem.c @@ -274,15 +274,6 @@ vy_mem_rollback_stmt(struct vy_mem *mem, struct tuple *stmt) /* {{{ vy_mem_iterator support functions */ /** - * Get a stmt by current position - */ -static struct tuple * -vy_mem_iterator_curr_stmt(struct vy_mem_iterator *itr) -{ - return *vy_mem_tree_iterator_get_elem(&itr->mem->tree, &itr->curr_pos); -} - -/** * Make a step in the iterator direction. * @retval 0 success * @retval 1 EOF @@ -296,7 +287,8 @@ vy_mem_iterator_step(struct vy_mem_iterator *itr) vy_mem_tree_iterator_next(&itr->mem->tree, &itr->curr_pos); if (vy_mem_tree_iterator_is_invalid(&itr->curr_pos)) return 1; - itr->curr_stmt = vy_mem_iterator_curr_stmt(itr); + itr->curr_stmt = *vy_mem_tree_iterator_get_elem(&itr->mem->tree, + &itr->curr_pos); return 0; } @@ -313,7 +305,8 @@ vy_mem_iterator_find_lsn(struct vy_mem_iterator *itr) { /* Skip to the first statement visible in the read view. */ assert(!vy_mem_tree_iterator_is_invalid(&itr->curr_pos)); - assert(itr->curr_stmt == vy_mem_iterator_curr_stmt(itr)); + assert(itr->curr_stmt == *vy_mem_tree_iterator_get_elem(&itr->mem->tree, + &itr->curr_pos)); struct key_def *cmp_def = itr->mem->cmp_def; while (vy_stmt_lsn(itr->curr_stmt) > (**itr->read_view).vlsn || vy_stmt_flags(itr->curr_stmt) & VY_STMT_SKIP_READ) { @@ -426,7 +419,8 @@ vy_mem_iterator_seek(struct vy_mem_iterator *itr, struct tuple *last_key) vy_mem_tree_iterator_prev(&itr->mem->tree, &itr->curr_pos); if (vy_mem_tree_iterator_is_invalid(&itr->curr_pos)) return 1; - itr->curr_stmt = vy_mem_iterator_curr_stmt(itr); + itr->curr_stmt = *vy_mem_tree_iterator_get_elem(&itr->mem->tree, + &itr->curr_pos); if (itr->iterator_type == ITER_EQ && ((last_key == NULL && !exact) || (last_key != NULL && vy_stmt_compare(itr->key, itr->curr_stmt, @@ -475,7 +469,8 @@ vy_mem_iterator_next_key(struct vy_mem_iterator *itr) return 1; assert(itr->mem->version == itr->version); assert(!vy_mem_tree_iterator_is_invalid(&itr->curr_pos)); - assert(itr->curr_stmt == vy_mem_iterator_curr_stmt(itr)); + assert(itr->curr_stmt == *vy_mem_tree_iterator_get_elem(&itr->mem->tree, + &itr->curr_pos)); struct key_def *cmp_def = itr->mem->cmp_def; struct tuple *prev_stmt = itr->curr_stmt; @@ -513,7 +508,8 @@ vy_mem_iterator_next_lsn(struct vy_mem_iterator *itr) return 1; assert(itr->mem->version == itr->version); assert(!vy_mem_tree_iterator_is_invalid(&itr->curr_pos)); - assert(itr->curr_stmt == vy_mem_iterator_curr_stmt(itr)); + assert(itr->curr_stmt == *vy_mem_tree_iterator_get_elem(&itr->mem->tree, + &itr->curr_pos)); struct key_def *cmp_def = itr->mem->cmp_def; struct vy_mem_tree_iterator next_pos = itr->curr_pos; -- 2.11.0
next prev parent reply other threads:[~2019-04-06 20:01 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-06 20:01 [PATCH v2 0/7] Incorporate tuple comparison hints into Vinyl Vladimir Davydov 2019-04-06 20:01 ` [PATCH v2 1/7] Move hint_t definition to tuple_compare.h Vladimir Davydov 2019-04-08 12:08 ` [tarantool-patches] " Konstantin Osipov 2019-04-06 20:01 ` [PATCH v2 2/7] vinyl: rename vy_cache_entry to vy_cache_node Vladimir Davydov 2019-04-08 12:09 ` [tarantool-patches] " Konstantin Osipov 2019-04-06 20:01 ` [PATCH v2 3/7] vinyl: rename tree_mem_key to vy_mem_tree_key Vladimir Davydov 2019-04-08 12:09 ` [tarantool-patches] " Konstantin Osipov 2019-04-06 20:01 ` Vladimir Davydov [this message] 2019-04-08 12:09 ` [tarantool-patches] Re: [PATCH v2 4/7] vinyl: zap vy_mem_iterator_curr_stmt helper Konstantin Osipov 2019-04-06 20:01 ` [PATCH v2 5/7] vinyl: add wrapper around vy_tx_set Vladimir Davydov 2019-04-06 20:01 ` [PATCH v2 6/7] vinyl: prepare for storing hints in vinyl data structures Vladimir Davydov 2019-04-06 20:01 ` [PATCH v2 7/7] vinyl: incorporate tuple comparison hints into " Vladimir Davydov 2019-04-07 12:33 ` [PATCH v2 0/7] Incorporate tuple comparison hints into Vinyl Vladimir Davydov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=2eedfbd806c2c06ae2f169fdc1239ac21070ebd6.1554580275.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH v2 4/7] vinyl: zap vy_mem_iterator_curr_stmt helper' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox