summary refs log tree commit diff
path: root/pkgs/development/lua-modules/luaexpat.patch
blob: 3dd6091084261620dd0b908b957ffa2febd4e056 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/src/lxplib.c b/src/lxplib.c
index 1c972db..5712611 100644
--- a/src/lxplib.c
+++ b/src/lxplib.c
@@ -590,7 +590,7 @@ static void set_info (lua_State *L) {
 /*
 ** Adapted from Lua 5.2.0
 */
-static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
+static void compat_luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
   luaL_checkstack(L, nup, "too many upvalues");
   for (; l->name != NULL; l++) {  /* fill the table with given functions */
     int i;
@@ -602,6 +602,8 @@ static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
   }
   lua_pop(L, nup);  /* remove upvalues */
 }
+#else
+#define compat_luaL_setfuncs(L, reg, nup) luaL_setfuncs(L, reg, nup)
 #endif
 
 
@@ -612,11 +614,11 @@ int luaopen_lxp (lua_State *L) {
 	lua_pushvalue(L, -2);
 	lua_rawset(L, -3);
 
-	luaL_setfuncs (L, lxp_meths, 0);
+	compat_luaL_setfuncs (L, lxp_meths, 0);
 	lua_pop (L, 1); /* remove metatable */
 
 	lua_newtable (L);
-	luaL_setfuncs (L, lxp_funcs, 0);
+	compat_luaL_setfuncs (L, lxp_funcs, 0);
 	set_info (L);
 	return 1;
 }