Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] lua: do not use internal api in public headers
@ 2020-07-20  8:53 Timur Safin
  2020-07-20 11:34 ` Igor Munkin
  0 siblings, 1 reply; 2+ messages in thread
From: Timur Safin @ 2020-07-20  8:53 UTC (permalink / raw)
  To: imun; +Cc: tarantool-patches

src/lua/utils.[ch] is part of public api which will
be integrated into module.h at the build step. It
should not refer to the internal LuaJIT API like
lj_state_growstack1(), otherwise it has not chance
to be linked in while building external binary module.

Relates to vshard-cluster-api#5
---

Branch: https://github.com/tarantool/tarantool/tree/tsafin/gh-vshard-cluster-api-5-no-private-api
Issue: https://github.com/tarantool/vshard-cluster-api/issues/5

 src/lua/utils.c | 13 +++++++++++++
 src/lua/utils.h | 14 ++------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/lua/utils.c b/src/lua/utils.c
index 0b05d7257..710d9c1fc 100644
--- a/src/lua/utils.c
+++ b/src/lua/utils.c
@@ -1054,6 +1054,19 @@ luaT_tolstring(lua_State *L, int idx, size_t *len)
 	return lua_tolstring(L, -1, len);
 }
 
+lua_State *
+luaT_newthread(lua_State *L)
+{
+	lua_State *L1 = NULL;
+	if (luaT_cpcall(L, luaT_newthread_wrapper, &L1) != 0) {
+		return NULL;
+	}
+	assert(L1 != NULL);
+	setthreadV(L, L->top, L1);
+	incr_top(L);
+	return L1;
+}
+
 /* Based on ffi_meta___call() from luajit/src/lib_ffi.c. */
 static int
 luaL_cdata_iscallable(lua_State *L, int idx)
diff --git a/src/lua/utils.h b/src/lua/utils.h
index b10754e4a..1e29d0f02 100644
--- a/src/lua/utils.h
+++ b/src/lua/utils.h
@@ -613,18 +613,8 @@ luaT_newthread_wrapper(lua_State *L)
  * @param L is a Lua State
  * @sa lua_newthread()
  */
-static inline lua_State *
-luaT_newthread(lua_State *L)
-{
-	lua_State *L1 = NULL;
-	if (luaT_cpcall(L, luaT_newthread_wrapper, &L1) != 0) {
-		return NULL;
-	}
-	assert(L1 != NULL);
-	setthreadV(L, L->top, L1);
-	incr_top(L);
-	return L1;
-}
+lua_State *
+luaT_newthread(lua_State *L);
 
 /**
  * Check if a value on @a L stack by index @a idx is an ibuf
-- 
2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Tarantool-patches] [PATCH] lua: do not use internal api in public headers
  2020-07-20  8:53 [Tarantool-patches] [PATCH] lua: do not use internal api in public headers Timur Safin
@ 2020-07-20 11:34 ` Igor Munkin
  0 siblings, 0 replies; 2+ messages in thread
From: Igor Munkin @ 2020-07-20 11:34 UTC (permalink / raw)
  To: Timur Safin; +Cc: tarantool-patches

Timur,

Thanks for your changes! It does solve your problem, but I propose to
drop this patch in favour of mine[1].

On 20.07.20, Timur Safin wrote:
> src/lua/utils.[ch] is part of public api which will
> be integrated into module.h at the build step. It
> should not refer to the internal LuaJIT API like
> lj_state_growstack1(), otherwise it has not chance
> to be linked in while building external binary module.
> 
> Relates to vshard-cluster-api#5

Side note: I doubt this line refers the issue the right way.

> ---
> 
> Branch: https://github.com/tarantool/tarantool/tree/tsafin/gh-vshard-cluster-api-5-no-private-api
> Issue: https://github.com/tarantool/vshard-cluster-api/issues/5
> 
>  src/lua/utils.c | 13 +++++++++++++
>  src/lua/utils.h | 14 ++------------
>  2 files changed, 15 insertions(+), 12 deletions(-)
> 

<snipped>

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-July/018745.html

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-20 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20  8:53 [Tarantool-patches] [PATCH] lua: do not use internal api in public headers Timur Safin
2020-07-20 11:34 ` Igor Munkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox