[Tarantool-patches] [PATCH v4 2/3] box: add binary search for _session_settings space
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Feb 4 01:17:19 MSK 2020
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 at 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;
More information about the Tarantool-patches
mailing list