Skip to content

Commit 9b6c49a

Browse files
prepare 1.0.1 release (#15)
1 parent 1320291 commit 9b6c49a

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

launchdarkly-server-sdk.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,41 +1172,43 @@ static const struct luaL_Reg launchdarkly_store_methods[] = {
11721172
{ NULL, NULL }
11731173
};
11741174

1175-
#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501
11761175
/*
11771176
** Adapted from Lua 5.2.0
11781177
*/
1179-
static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
1180-
luaL_checkstack(L, nup+1, "too many upvalues");
1181-
for (; l->name != NULL; l++) { /* fill the table with given functions */
1182-
int i;
1183-
lua_pushstring(L, l->name);
1184-
for (i = 0; i < nup; i++) /* copy upvalues to the top */
1185-
lua_pushvalue(L, -(nup+1));
1186-
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
1187-
lua_settable(L, -(nup + 3));
1188-
}
1189-
lua_pop(L, nup); /* remove upvalues */
1178+
static void
1179+
ld_luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
1180+
{
1181+
luaL_checkstack(L, nup+1, "too many upvalues");
1182+
for (; l->name != NULL; l++) { /* fill the table with given functions */
1183+
int i;
1184+
lua_pushstring(L, l->name);
1185+
/* copy upvalues to the top */
1186+
for (i = 0; i < nup; i++) {
1187+
lua_pushvalue(L, -(nup+1));
1188+
}
1189+
lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
1190+
lua_settable(L, -(nup + 3));
1191+
}
1192+
lua_pop(L, nup); /* remove upvalues */
11901193
}
1191-
#endif
11921194

11931195
int
11941196
luaopen_launchdarkly_server_sdk(lua_State *const l)
11951197
{
11961198
luaL_newmetatable(l, "LaunchDarklyClient");
11971199
lua_pushvalue(l, -1);
11981200
lua_setfield(l, -2, "__index");
1199-
luaL_setfuncs(l, launchdarkly_client_methods, 0);
1201+
ld_luaL_setfuncs(l, launchdarkly_client_methods, 0);
12001202

12011203
luaL_newmetatable(l, "LaunchDarklyUser");
12021204
lua_pushvalue(l, -1);
12031205
lua_setfield(l, -2, "__index");
1204-
luaL_setfuncs(l, launchdarkly_user_methods, 0);
1206+
ld_luaL_setfuncs(l, launchdarkly_user_methods, 0);
12051207

12061208
luaL_newmetatable(l, "LaunchDarklyStoreInterface");
12071209
lua_pushvalue(l, -1);
12081210
lua_setfield(l, -2, "__index");
1209-
luaL_setfuncs(l, launchdarkly_store_methods, 0);
1211+
ld_luaL_setfuncs(l, launchdarkly_store_methods, 0);
12101212

12111213
#if LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 502
12121214
luaL_newlib(l, launchdarkly_functions);

0 commit comments

Comments
 (0)