MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaopen_cmsgpack_safe

Function luaopen_cmsgpack_safe

app/redis-6.2.6/deps/lua/src/lua_cmsgpack.c:935–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933}
934
935LUALIB_API int luaopen_cmsgpack_safe(lua_State *L) {
936 int i;
937
938 luaopen_cmsgpack(L);
939
940 /* Wrap all functions in the safe handler */
941 for (i = 0; i < (sizeof(cmds)/sizeof(*cmds) - 1); i++) {
942 lua_getfield(L, -1, cmds[i].name);
943 lua_pushcclosure(L, mp_safe, 1);
944 lua_setfield(L, -2, cmds[i].name);
945 }
946
947#if LUA_VERSION_NUM < 502
948 /* Register name globally for 5.1 */
949 lua_pushvalue(L, -1);
950 lua_setglobal(L, LUACMSGPACK_SAFE_NAME);
951#endif
952
953 return 1;
954}
955
956/******************************************************************************
957* Copyright (C) 2012 Salvatore Sanfilippo. All rights reserved.

Callers

nothing calls this directly

Calls 5

lua_setglobalFunction · 0.85
lua_getfieldFunction · 0.70
lua_pushcclosureFunction · 0.70
lua_setfieldFunction · 0.70
lua_pushvalueFunction · 0.70

Tested by

no test coverage detected