From fad05f89a7168aceaaff207114d86ab7e38a2181 Mon Sep 17 00:00:00 2001 From: Wendal Chen Date: Wed, 22 May 2024 21:48:26 +0800 Subject: [PATCH] =?utf8?q?change:=20rotable2=E7=9A=84userdata=E6=80=BB?= =?utf8?q?=E6=98=AF=E4=B8=8D=E9=9C=80=E8=A6=81=E5=9B=9E=E6=94=B6=E7=9A=84,?= =?utf8?q?=E4=BB=8Eallgc=E7=A7=BB=E5=88=B0fixed=5Fgc,=E5=87=8F=E5=B0=91?= =?utf8?q?=E6=AF=8F=E6=AC=A1gc=E9=81=8D=E5=8E=86=E7=9A=84GCObject?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lua/src/rotable2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/src/rotable2.c b/lua/src/rotable2.c index 4b58a4d0..753fa9f5 100644 --- a/lua/src/rotable2.c +++ b/lua/src/rotable2.c @@ -88,6 +88,7 @@ static rotable* check_rotable( lua_State* L, int idx, char const* func ) { static const rotable_Reg_t* find_key( const rotable_Reg_t* p, int n, char const* s ) { + (void)n; if( s ) { for( ; p->name != NULL; ++p ) { if( 0 == reg_compare( s, p ) ) @@ -197,10 +198,11 @@ static int rotable_udata_pairs( lua_State* L ) { /** * 与lua_newlib对应的函数, 用于生成一个库table,区别是lua_newlib生成普通table,这个函数生成rotable. */ - +#include "lgc.h" ROTABLE_EXPORT void rotable2_newlib( lua_State* L, void const* v ) { const rotable_Reg_t* reg = (const rotable_Reg_t*)v; rotable* t = (rotable*)lua_newuserdata( L, sizeof( *t ) ); + luaC_fix(L, L->l_G->allgc); lua_pushlightuserdata( L, (void*)unique_address ); lua_rawget( L, LUA_REGISTRYINDEX ); if( !lua_istable( L, -1 ) ) { -- 2.11.4.GIT