From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 38F152ECE9 for ; Fri, 26 Oct 2018 11:00:06 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tJKBEhsHk6OU for ; Fri, 26 Oct 2018 11:00:06 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 97C2E2ECDD for ; Fri, 26 Oct 2018 11:00:05 -0400 (EDT) From: Nikita Pettik Subject: [tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor Date: Fri, 26 Oct 2018 17:59:26 +0300 Message-Id: <20181026145926.15345-1-korablev@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik nKey member (indicating number of parts in key) now is used only for COUNT routine. On the other hand, it is always equal to 0 (as well as key is really NULL). Hence, nothing prevents us from removing this field at all. --- https://github.com/tarantool/tarantool/tree/np/remove-nkey-from-cursor src/box/sql.c | 7 ++----- src/box/sql/cursor.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/box/sql.c b/src/box/sql.c index c7b87e57a..9d58b8fcf 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -340,8 +340,7 @@ int tarantoolSqlite3EphemeralCount(struct BtCursor *pCur, i64 *pnEntry) assert(pCur->curFlags & BTCF_TEphemCursor); struct index *primary_index = space_index(pCur->space, 0 /* PK */); - *pnEntry = index_count(primary_index, pCur->iter_type, pCur->key, - pCur->nKey); + *pnEntry = index_count(primary_index, pCur->iter_type, 0, 0); return SQLITE_OK; } @@ -349,8 +348,7 @@ int tarantoolSqlite3Count(BtCursor *pCur, i64 *pnEntry) { assert(pCur->curFlags & BTCF_TaCursor); - *pnEntry = index_count(pCur->index, pCur->iter_type, pCur->key, - pCur->nKey); + *pnEntry = index_count(pCur->index, pCur->iter_type, 0, 0); return SQLITE_OK; } @@ -1031,7 +1029,6 @@ key_alloc(BtCursor *cur, size_t key_size) } cur->key = new_key; } - cur->nKey = key_size; return 0; } diff --git a/src/box/sql/cursor.h b/src/box/sql/cursor.h index da711a7de..d40ca87c8 100644 --- a/src/box/sql/cursor.h +++ b/src/box/sql/cursor.h @@ -41,7 +41,6 @@ typedef struct BtCursor BtCursor; * for ordinary space, or to TEphemCursor for ephemeral space. */ struct BtCursor { - i64 nKey; /* Size of pKey, or last integer key */ u8 curFlags; /* zero or more BTCF_* flags defined below */ u8 eState; /* One of the CURSOR_XXX constants (see below) */ u8 hints; /* As configured by CursorSetHints() */ -- 2.15.1