Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Chris Sosnin <k.sosnin@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v4 2/3] box: add binary search for _session_settings space
Date: Mon, 3 Feb 2020 23:17:19 +0100	[thread overview]
Message-ID: <4bfe72ac-ab2e-9832-d963-51bd181a27b4@tarantool.org> (raw)
In-Reply-To: <00c4f2f6dde45fe05cafd32ec60eeaaa5cbce6cc.1580215539.git.k.sosnin@tarantool.org>

Thanks for the patch!

I've pushed my review fixes on top of this commit. See it below
and on the branch. If you agree, then squash. Otherwise lets
discuss.

================================================================================

commit 2d72be324e331055f13d5ca8e515b0dbf8837cc6
Author: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Date:   Mon Feb 3 22:03:57 2020 +0100

    Review fixes

diff --git a/src/box/session_settings.c b/src/box/session_settings.c
index bd98bd360..653a56b77 100644
--- a/src/box/session_settings.c
+++ b/src/box/session_settings.c
@@ -197,18 +197,18 @@ session_settings_iterator_next(struct iterator *iterator, struct tuple **result)
 {
 	struct session_settings_iterator *it =
 		(struct session_settings_iterator *)iterator;
-	int rc, sid = it->setting_id;
+	int sid = it->setting_id;
 	const char *key = it->key;
 	bool is_including = it->is_including, is_eq = it->is_eq;
-	bool is_found = false;
+	bool is_found;
 	if (!it->is_set) {
 		it->is_set = true;
-		rc = session_settings_set_forward(&sid, key, is_eq,
-						  is_including);
+		is_found = session_settings_set_forward(&sid, key, is_eq,
+							is_including) == 0;
 	} else {
-		rc = session_settings_next(&sid, key, is_eq, is_including);
+		is_found = session_settings_next(&sid, key, is_eq,
+						 is_including) == 0;
 	}
-	is_found = rc == 0;
 	it->setting_id = sid + 1;
 	if (!is_found) {
 		*result = NULL;
@@ -225,18 +225,18 @@ session_settings_iterator_prev(struct iterator *iterator, struct tuple **result)
 {
 	struct session_settings_iterator *it =
 		(struct session_settings_iterator *)iterator;
-	int rc, sid = it->setting_id;
+	int sid = it->setting_id;
 	const char *key = it->key;
 	bool is_including = it->is_including, is_eq = it->is_eq;
-	bool is_found = false;
+	bool is_found;
 	if (!it->is_set) {
 		it->is_set = true;
-		rc = session_settings_set_reverse(&sid, key, is_eq,
-						  is_including);
+		is_found = session_settings_set_reverse(&sid, key, is_eq,
+							is_including) == 0;
 	} else {
-		rc = session_settings_prev(&sid, key, is_eq, is_including);
+		is_found = session_settings_prev(&sid, key, is_eq,
+						 is_including) == 0;
 	}
-	is_found = rc == 0;
 	it->setting_id = sid - 1;
 	if (!is_found) {
 		*result = NULL;

  reply	other threads:[~2020-02-03 22:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 12:50 [Tarantool-patches] [PATCH v4 0/3] box: session settings fixes Chris Sosnin
2020-01-28 12:50 ` [Tarantool-patches] [PATCH v4 1/3] box: replace session_settings modules with a single array Chris Sosnin
2020-02-03 22:17   ` Vladislav Shpilevoy
2020-02-04 19:29     ` [Tarantool-patches] [PATCH 1/4] " Chris Sosnin
2020-02-06 22:14       ` Vladislav Shpilevoy
2020-01-28 12:50 ` [Tarantool-patches] [PATCH v4 2/3] box: add binary search for _session_settings space Chris Sosnin
2020-02-03 22:17   ` Vladislav Shpilevoy [this message]
2020-02-04 19:30     ` [Tarantool-patches] [PATCH 2/4] " Chris Sosnin
2020-02-06 22:15       ` Vladislav Shpilevoy
2020-01-28 12:50 ` [Tarantool-patches] [PATCH v4 3/3] box: provide a user friendly frontend for accessing session settings Chris Sosnin
2020-02-03 22:17   ` Vladislav Shpilevoy
2020-02-04 19:31     ` [Tarantool-patches] [PATCH 3/4] " Chris Sosnin
2020-02-06 22:15       ` Vladislav Shpilevoy
2020-02-03 22:17 ` [Tarantool-patches] [PATCH v4 0/3] box: session settings fixes Vladislav Shpilevoy

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=4bfe72ac-ab2e-9832-d963-51bd181a27b4@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=k.sosnin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 2/3] box: add binary search for _session_settings space' \
    /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