[tarantool-patches] Re: [PATCH v2 0/7] sql: store regular identifiers in case-normal form
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Mar 26 20:09:00 MSK 2019
Hi! Thanks for the fixes!
Please, look at the diff below and on the branch.
=============================================================
commit d41b8abf83f31e8ce2ae1792a211c096e48e39e1
Author: Vladislav Shpilevoy <v.shpilevoy at 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,
More information about the Tarantool-patches
mailing list