Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] Fix assignment operation in assertions
@ 2020-06-27 19:40 Nikita Pettik
  2020-06-29 20:19 ` Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Nikita Pettik @ 2020-06-27 19:40 UTC (permalink / raw)
  To: tarantool-patches; +Cc: v.shpilevoy

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-30 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 19:40 [Tarantool-patches] [PATCH] Fix assignment operation in assertions Nikita Pettik
2020-06-29 20:19 ` Vladislav Shpilevoy
2020-06-30 13:46   ` Nikita Pettik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox