From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0146E4696C4 for ; Tue, 4 Feb 2020 01:17:20 +0300 (MSK) References: <00c4f2f6dde45fe05cafd32ec60eeaaa5cbce6cc.1580215539.git.k.sosnin@tarantool.org> From: Vladislav Shpilevoy Message-ID: <4bfe72ac-ab2e-9832-d963-51bd181a27b4@tarantool.org> Date: Mon, 3 Feb 2020 23:17:19 +0100 MIME-Version: 1.0 In-Reply-To: <00c4f2f6dde45fe05cafd32ec60eeaaa5cbce6cc.1580215539.git.k.sosnin@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v4 2/3] box: add binary search for _session_settings space List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chris Sosnin , tarantool-patches@dev.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 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;