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 276C826138 for ; Thu, 14 Jun 2018 12:12:34 -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 sgVtbAxQMvc2 for ; Thu, 14 Jun 2018 12:12:34 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 D966720341 for ; Thu, 14 Jun 2018 12:12:33 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 07/11] sql: move sqlite3DeleteTrigger to sql.h References: <8e81edd81ecfcb8b90330fde614c95488df15dfc.1528535873.git.kshcherbatov@tarantool.org> <36043cc5-accb-51b3-5794-11bdf4361758@tarantool.org> From: Kirill Shcherbatov Message-ID: <9bee6ffc-b55b-294f-1b96-94143d2d1ba8@tarantool.org> Date: Thu, 14 Jun 2018 19:12:31 +0300 MIME-Version: 1.0 In-Reply-To: <36043cc5-accb-51b3-5794-11bdf4361758@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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" On 13.06.2018 21:53, Vladislav Shpilevoy wrote: > Thanks for the patch! > Please, rationalize the patch in the commit message. > I know why the patch is needed, but Nikita, for example, > does not. Anyone else either. sql: move sqlite3DeleteTrigger to sql.h As we are going to port triggers to server, we need an instrument to release allocated memory in alter.cc. Part of #3273. > Please, apply this: - for (pElem = sqliteHashFirst(&temp2); pElem; - pElem = sqliteHashNext(pElem)) { - sql_trigger_delete(0, (Trigger *) sqliteHashData(pElem)); - } + for (pElem = sqliteHashFirst(&temp2); pElem != NULL; + pElem = sqliteHashNext(pElem)) + sql_trigger_delete(NULL, (Trigger *) sqliteHashData(pElem)); - if (!pParse->pNewTrigger) { + if (pParse->pNewTrigger == NULL) sql_trigger_delete(db, pTrigger); - } else { + else assert(pParse->pNewTrigger == pTrigger); - }