Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2 0/7] sql: store regular identifiers in case-normal form
Date: Tue, 26 Mar 2019 20:09:00 +0300	[thread overview]
Message-ID: <d26ee3a6-8b8e-121d-4b1a-85dc01ee178f@tarantool.org> (raw)
In-Reply-To: <af112be6-ce72-da56-ac95-c8bdfdffd86e@tarantool.org>

Hi! Thanks for the fixes!

Please, look at the diff below and on the branch.

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

commit d41b8abf83f31e8ce2ae1792a211c096e48e39e1
Author: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Date:   Mon Mar 25 15:49:09 2019 +0300

     Review fix

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index dae582d1f..7bd99feb6 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -2521,21 +2521,18 @@ sql_id_list_append(struct sql *db, struct IdList *list,
  		   struct Token *name_token)
  {
  	if (list == NULL &&
-	    (list = sqlDbMallocZero(db, sizeof(struct IdList))) == NULL) {
-		diag_set(OutOfMemory, sizeof(struct IdList), "sqlDbMallocZero",
-			 "list");
+	    (list = sqlDbMallocZero(db, sizeof(*list))) == NULL) {
+		diag_set(OutOfMemory, sizeof(*list), "sqlDbMallocZero", "list");
  		return NULL;
  	}
  	int i;
  	list->a = sqlArrayAllocate(db, list->a, sizeof(list->a[0]),
  				   &list->nId, &i);
-	if (i < 0)
-		goto error;
-	list->a[i].zName = sqlNameFromToken(db, name_token);
-	if (list->a[i].zName == NULL)
-		goto error;
-	return list;
-error:
+	if (i >= 0) {
+		list->a[i].zName = sqlNameFromToken(db, name_token);
+		if (list->a[i].zName != NULL)
+			return list;
+	}
  	sqlIdListDelete(db, list);
  	return NULL;
  }
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 192929747..998a601c2 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -3419,8 +3419,8 @@ void *sqlArrayAllocate(sql *, void *, int, int *, int *);
   * @param db The database connection.
   * @param list The pointer to existent Id list if exists.
   * @param name_token The token containing name.
- * @retval Not NULL IdList pointer is returned on success.
- * @retval NULL Otherwise. Diag message is set.
+ * @retval Not NULL A new list or updated @a list.
+ * @retval NULL Error. Diag message is set.
   */
  struct IdList *
  sql_id_list_append(struct sql *db, struct IdList *list,

  reply	other threads:[~2019-03-26 17:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 11:13 [tarantool-patches] " Kirill Shcherbatov
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 1/7] sql: refactor sql_alloc_src_list to set diag Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 2/7] sql: rework sql_src_list_enlarge " Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 3/7] sql: refactor sql_src_list_append " Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-03-18 19:33       ` Vladislav Shpilevoy
2019-03-20 11:02         ` Kirill Shcherbatov
2019-03-26 17:08           ` Vladislav Shpilevoy
2019-03-26 18:07             ` Vladislav Shpilevoy
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 4/7] sql: refactor sql_name_from_token " Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-03-18 19:33       ` Vladislav Shpilevoy
2019-03-20 11:02         ` Kirill Shcherbatov
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 5/7] sql: refactor sql_trigger_step_allocate " Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-03-18 19:33       ` Vladislav Shpilevoy
2019-03-20 11:02         ` Kirill Shcherbatov
2019-03-26 17:08           ` Vladislav Shpilevoy
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 6/7] sql: refactor sql_expr_create " Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-03-18 19:33       ` Vladislav Shpilevoy
2019-03-20 11:02         ` Kirill Shcherbatov
2019-03-26 17:08           ` Vladislav Shpilevoy
2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 7/7] sql: store regular identifiers in case-normal form Kirill Shcherbatov
2019-03-07 17:34   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-11 15:04     ` Kirill Shcherbatov
2019-03-18 19:33       ` Vladislav Shpilevoy
2019-03-20 11:02         ` Kirill Shcherbatov
2019-03-26 17:08           ` Vladislav Shpilevoy
2019-03-18 19:33 ` [tarantool-patches] Re: [PATCH v2 0/7] " Vladislav Shpilevoy
2019-03-20 11:02   ` Kirill Shcherbatov
2019-03-26 17:09     ` Vladislav Shpilevoy [this message]
2019-03-27 14:06 ` 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=d26ee3a6-8b8e-121d-4b1a-85dc01ee178f@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 0/7] sql: store regular identifiers in case-normal form' \
    /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