From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 197C446970E for ; Tue, 24 Dec 2019 19:47:30 +0300 (MSK) References: <20191224013731.GE41539@tarantool.org> From: Vladislav Shpilevoy Message-ID: <1965e99f-ca25-c260-3ba9-70d868404d14@tarantool.org> Date: Tue, 24 Dec 2019 17:47:28 +0100 MIME-Version: 1.0 In-Reply-To: <20191224013731.GE41539@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 1/2] sql: remove grants associated with the table List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik , Chris Sosnin Cc: tarantool-patches@dev.tarantool.org >> + for (uint8_t token = 0; token < BOX_USER_MAX; ++token) { >> + if (!access[token].granted) >> + continue; >> + had_grants = true; > > Personally I wouldn't bother with separate variable solely to > display comment. Let's keep it tho. > We wouldn't either, but appears that VdbeComment asserts when there is no operation before it. So we must ensure, that the comment is added only in case at least one opcode is generated. >> + const struct user *user = user_find_by_token(token); >> + sqlVdbeAddOp2(v, OP_Integer, user->def->uid, key_reg); >> + sqlVdbeAddOp4(v, OP_String8, 0, key_reg + 1, 0, >> + object_type, P4_STATIC); >> + sqlVdbeAddOp2(v, OP_Integer, object_id, key_reg + 2); >> + sqlVdbeAddOp3(v, OP_MakeRecord, key_reg, 3, key_reg + 3); >> + sqlVdbeAddOp2(v, OP_SDelete, BOX_PRIV_ID, key_reg + 3); >> + } >> + if (had_grants) >> + VdbeComment((v, "Remove %s grants", object_type)); >> + sqlReleaseTempRange(parser, key_reg, 4); >> +} >> +