From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (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 633BF469719 for ; Fri, 2 Oct 2020 19:14:01 +0300 (MSK) From: "Timur Safin" References: <7eaf13e0ac86f3c9afe521d82d2dc907479b3ffe.1600955781.git.tsafin@tarantool.org> In-Reply-To: Date: Fri, 2 Oct 2020 19:14:01 +0300 Message-ID: <0ad801d698d7$0ad61080$20823180$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH 2.X 7/7] module api: luaL_cdata_iscallable List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Vladislav Shpilevoy' , alexander.turenko@tarantool.org Cc: tarantool-patches@dev.tarantool.org : From: Vladislav Shpilevoy : Subject: Re: [Tarantool-patches] [PATCH 2.X 7/7] module api: : luaL_cdata_iscallable : : Thanks for the patch! : : See 4 comments below. : : On 24.09.2020 19:00, Timur Safin wrote: : > In addition to `luaL_iscallable` we need `luaL_cdata_iscallable` : > because code which was calling it directly had to be copied to : > merger side : : 1. Please, put '.' in the end of sentences. Here and in other : commits. : : 2. luaL_iscallable() already checks luaL_cdata_iscallable(). Why : do you need it separated from luaL_iscallable()? Good question - indeed. I needed luaL_cdata_iscallable only while luaL_iscallable was part of compat layer inside of merger module. Now having luaL_iscallable as part of module api both in 1.10 and 2.* the luaL_cdata_iscallable could be local, as it used to be before. Let me check whether I miss some details I needed in both versions we attack? : : > Part of #5273 : > --- : > src/exports.h | 1 + : > src/lua/utils.c | 2 +- : > src/lua/utils.h | 6 ++++++ : > 3 files changed, 8 insertions(+), 1 deletion(-) : > : > diff --git a/src/lua/utils.h b/src/lua/utils.h : > index 6b10d2755..69ff4de86 100644 : > --- a/src/lua/utils.h : > +++ b/src/lua/utils.h : > @@ -541,6 +541,12 @@ luaT_tolstring(lua_State *L, int idx, size_t : *ssize); : > LUA_API int : > luaL_iscallable(lua_State *L, int idx); : > : > +/** : > + * Check whether a Lua object is a cdata metatype with a __call field. : : 3. The function will crash in debug build, if it is not cdata. And will : do UB in release build. This is because it is not supposed to be called : out of luaL_iscallable(). And I don't see why would you need it. I hear, hear. Don't need to repeat it twice. Don't need to repeat it twice. : : > + * : : 4. Extra empty line. : : > + */ : > +LUA_API int : > +luaL_cdata_iscallable(lua_State *L, int idx); Regards, Timur