Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: v.shpilevoy@tarantool.org
Subject: [Tarantool-patches] [PATCH] Fix assignment operation in assertions
Date: Sat, 27 Jun 2020 22:40:40 +0300	[thread overview]
Message-ID: <5c03f978f0ceda59adb41fd47a1c502bbf82acbc.1593285714.git.korablev@tarantool.org> (raw)

Accidentally assignment is used in assertions instead of comparison
operation. Let's fix this mistake and use comparison.
---
Nothing serious, fortunatelly.

Branch: https://github.com/tarantool/tarantool/tree/np/vinyl-fix-asserts

 src/box/key_def.c | 2 +-
 src/box/vinyl.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/box/key_def.c b/src/box/key_def.c
index 18af44961..a03537227 100644
--- a/src/box/key_def.c
+++ b/src/box/key_def.c
@@ -123,7 +123,7 @@ void
 key_def_copy(struct key_def *dest, const struct key_def *src)
 {
 	size_t sz = key_def_copy_size(src);
-	assert(sz = key_def_copy_size(dest));
+	assert(sz == key_def_copy_size(dest));
 	key_def_copy_impl(dest, src, sz);
 }
 
diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index 6f06f9b11..fd9b7e6c0 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -3528,7 +3528,7 @@ vinyl_iterator_primary_next(struct iterator *base, struct tuple **ret)
 {
 	double start_time = ev_monotonic_now(loop());
 
-	assert(base->next = vinyl_iterator_primary_next);
+	assert(base->next == vinyl_iterator_primary_next);
 	struct vinyl_iterator *it = (struct vinyl_iterator *)base;
 	struct vy_lsm *lsm = it->iterator.lsm;
 	assert(lsm->index_id == 0);
@@ -3566,7 +3566,7 @@ vinyl_iterator_secondary_next(struct iterator *base, struct tuple **ret)
 {
 	double start_time = ev_monotonic_now(loop());
 
-	assert(base->next = vinyl_iterator_secondary_next);
+	assert(base->next == vinyl_iterator_secondary_next);
 	struct vinyl_iterator *it = (struct vinyl_iterator *)base;
 	struct vy_lsm *lsm = it->iterator.lsm;
 	assert(lsm->index_id > 0);
-- 
2.17.1

             reply	other threads:[~2020-06-27 19:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27 19:40 Nikita Pettik [this message]
2020-06-29 20:19 ` Vladislav Shpilevoy
2020-06-30 13:46   ` Nikita Pettik

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=5c03f978f0ceda59adb41fd47a1c502bbf82acbc.1593285714.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Fix assignment operation in assertions' \
    /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