From: Patrick Donnelly Date: Tue, 13 Oct 2020 18:19:45 +0000 (-0700) Subject: rgw: use more efficient lua_pushliteral X-Git-Tag: v16.1.0~733^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ceb4e0f064598aac79944bd11d23c5f888f09ce;p=ceph.git rgw: use more efficient lua_pushliteral This avoids an unnecessary call to strlen. Signed-off-by: Patrick Donnelly --- diff --git a/src/rgw/rgw_lua_utils.h b/src/rgw/rgw_lua_utils.h index 3462e0ed686..55545431b79 100644 --- a/src/rgw/rgw_lua_utils.h +++ b/src/rgw/rgw_lua_utils.h @@ -95,25 +95,25 @@ void create_metatable(lua_State* L, bool toplevel, Upvalues... upvalues) } // create metatable [[maybe_unused]] const auto rc = luaL_newmetatable(L, MetaTable::Name().c_str()); - lua_pushstring(L, "__index"); + lua_pushliteral(L, "__index"); for (const auto upvalue : upvalue_arr) { lua_pushlightuserdata(L, upvalue); } lua_pushcclosure(L, MetaTable::IndexClosure, upvals_size); lua_rawset(L, -3); - lua_pushstring(L, "__newindex"); + lua_pushliteral(L, "__newindex"); for (const auto upvalue : upvalue_arr) { lua_pushlightuserdata(L, upvalue); } lua_pushcclosure(L, MetaTable::NewIndexClosure, upvals_size); lua_rawset(L, -3); - lua_pushstring(L, "__pairs"); + lua_pushliteral(L, "__pairs"); for (const auto upvalue : upvalue_arr) { lua_pushlightuserdata(L, upvalue); } lua_pushcclosure(L, MetaTable::PairsClosure, upvals_size); lua_rawset(L, -3); - lua_pushstring(L, "__len"); + lua_pushliteral(L, "__len"); for (const auto upvalue : upvalue_arr) { lua_pushlightuserdata(L, upvalue); }