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 74A5620CB7 for ; Tue, 3 Jul 2018 20:08:35 -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 xq7IQCGd5_ov for ; Tue, 3 Jul 2018 20:08:35 -0400 (EDT) Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 3542F20CA5 for ; Tue, 3 Jul 2018 20:08:35 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v9] sql: add index_def to struct Index References: <9A0A687D-2E0B-4AB9-B223-1A1287817824@tarantool.org> <8900ae2a-59e8-d69a-7f5d-95436b23214a@tarantool.org> <0e795fb5-1ee8-e7e6-65e4-7347787f3248@tarantool.org> <898ec1ac-51b9-13a6-6298-3a20eeac5b2b@tarantool.org> <76c1ec30-4f33-bc91-8845-72a99fc4ef0f@tarantool.org> <6fbc3849-a204-6cd9-82cd-2fb22769ccf0@tarantool.org> <2d4908aa-0243-8dc3-e109-707cb482b7f6@tarantool.org> From: Vladislav Shpilevoy Message-ID: <82d4d235-c105-b6b4-dad1-7ae42c23f0ea@tarantool.org> Date: Wed, 4 Jul 2018 03:08:31 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit 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, "n.pettik" Cc: Ivan Koptelov >> + uint32_t iid, const char *name, uint32_t name_len, bool is_unique, >> + struct ExprList *expr_list, u8 idx_type) >> +{ >> + struct space_def *space_def = table->def; >> + size_t sql_size = 0; >> + struct index_opts opts; >> + index_opts_create(&opts); >> + index->def = NULL; >> + opts.is_unique = is_unique; >> + int rc = -1; > > You don’t use this variable and in the end just reassign it: This variable is reassigned on success only. On any error we go to cleanup or tnt_error and rc remains -1. > > + if (index->def == NULL) > + goto tnt_error; > + rc = 0; > +cleanup: > + if (key_def != NULL) > + key_def_delete(key_def); > + return rc; >