Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kyukhin@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] sql: drop a useless check from lookupName()
Date: Mon, 22 Apr 2019 21:34:40 +0300	[thread overview]
Message-ID: <fb525c50e478d2832005fa8c1eed1d8666359bf6.1555958029.git.v.shpilevoy@tarantool.org> (raw)

There was a variable used as a counter from 0 to
uint32_t space_def->field_count. Obviously it can't be < 0, but
there was a check for that. Drop it.

The check was revealed during SQL BOOLEAN review, where one of
patches gets rid of some explicit Expr.type assignments.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/drop-useless-check-from-resolve

 src/box/sql/resolve.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index f601bca7b..504096e6d 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -337,18 +337,11 @@ lookupName(Parse * pParse,	/* The parsing context */
 				}
 				if (iCol < (int)space_def->field_count) {
 					cnt++;
-					if (iCol < 0) {
-						pExpr->type =
-							FIELD_TYPE_INTEGER;
-					} else {
-						uint64_t *mask =
-							pExpr->iTable == 0 ?
-							&pParse->oldmask :
-							&pParse->newmask;
-						column_mask_set_fieldno(mask,
-									iCol);
-					}
-					pExpr->iColumn = (i16) iCol;
+					uint64_t *mask = pExpr->iTable == 0 ?
+							 &pParse->oldmask :
+							 &pParse->newmask;
+					column_mask_set_fieldno(mask, iCol);
+					pExpr->iColumn = iCol;
 					pExpr->space_def = space_def;
 					isTrigger = 1;
 				}
-- 
2.20.1 (Apple Git-117)

             reply	other threads:[~2019-04-22 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 18:34 Vladislav Shpilevoy [this message]
2019-04-23 10:24 ` [tarantool-patches] " Kirill Yukhin

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=fb525c50e478d2832005fa8c1eed1d8666359bf6.1555958029.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] sql: drop a useless check from lookupName()' \
    /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