vim/u_lua53_on_32bit.patch
Martin Pluskal 9aa3d19022 Accepting request 622507 from home:mimi_vx:branches:editors
- update to 8.1.0179
- add u_lua53_on_32bit.patch - fix lua53 support on 32bit 
 * Redundant condition for boundary check

OBS-URL: https://build.opensuse.org/request/show/622507
OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=504
2018-07-14 05:45:00 +00:00

102 lines
3.3 KiB
Diff

From 856aeb0d94f88d93fe1753c02b51ad57edc2f8c5 Mon Sep 17 00:00:00 2001
From: "K.Takata" <kentkt@csc.jp>
Date: Thu, 5 Jul 2018 23:22:47 +0900
Subject: [PATCH 1/2] if_lua: Fix coding style
---
src/if_lua.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/if_lua.c b/src/if_lua.c
index df0ef34545..1e3208c862 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -960,7 +960,8 @@ luaV_dict_newindex(lua_State *L)
luaL_error(L, "dict is locked");
if (key != NULL && *key == NUL)
luaL_error(L, "empty key");
- if (!lua_isnil(L, 3)) { /* read value? */
+ if (!lua_isnil(L, 3)) /* read value? */
+ {
luaV_checktypval(L, 3, &v, "setting dict item");
if (d->dv_scope == VAR_DEF_SCOPE && v.v_type == VAR_FUNC)
luaL_error(L, "cannot assign funcref to builtin scope");
@@ -1066,7 +1067,8 @@ luaV_funcref_call(lua_State *L)
f->args.vval.v_list = list_alloc();
rettv.v_type = VAR_UNKNOWN; /* as in clear_tv */
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++)
+ {
luaV_checktypval(L, i + 2, &v, "calling funcref");
list_append_tv(f->args.vval.v_list, &v);
}
@@ -1519,13 +1521,16 @@ luaV_list(lua_State *L)
else
{
luaV_newlist(L, l);
- if (initarg) { /* traverse table to init dict */
+ if (initarg) /* traverse table to init list */
+ {
int notnil, i = 0;
typval_T v;
- do {
+ do
+ {
lua_rawgeti(L, 1, ++i);
notnil = !lua_isnil(L, -1);
- if (notnil) {
+ if (notnil)
+ {
luaV_checktypval(L, -1, &v, "vim.list");
list_append_tv(l, &v);
}
@@ -1564,7 +1569,8 @@ luaV_dict(lua_State *L)
luaL_error(L, "table has empty key");
luaV_checktypval(L, -2, &v, "vim.dict"); /* value */
di = dictitem_alloc(key);
- if (di == NULL || dict_add(d, di) == FAIL) {
+ if (di == NULL || dict_add(d, di) == FAIL)
+ {
vim_free(di);
lua_pushnil(L);
return 1;
From 7664e9060a6921f248c917e78ad6f4f19e9774b3 Mon Sep 17 00:00:00 2001
From: "K.Takata" <kentkt@csc.jp>
Date: Thu, 5 Jul 2018 23:23:33 +0900
Subject: [PATCH 2/2] if_lua: Fix Lua 5.3 on 32-bit systems
---
src/if_lua.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/if_lua.c b/src/if_lua.c
index 1e3208c862..e30680941c 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -253,14 +253,23 @@ void (*dll_lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
void (*dll_lua_pushboolean) (lua_State *L, int b);
void (*dll_lua_pushlightuserdata) (lua_State *L, void *p);
void (*dll_lua_getfield) (lua_State *L, int idx, const char *k);
+#if LUA_VERSION_NUM <= 502
void (*dll_lua_rawget) (lua_State *L, int idx);
void (*dll_lua_rawgeti) (lua_State *L, int idx, int n);
+#else
+int (*dll_lua_rawget) (lua_State *L, int idx);
+int (*dll_lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
+#endif
void (*dll_lua_createtable) (lua_State *L, int narr, int nrec);
void *(*dll_lua_newuserdata) (lua_State *L, size_t sz);
int (*dll_lua_getmetatable) (lua_State *L, int objindex);
void (*dll_lua_setfield) (lua_State *L, int idx, const char *k);
void (*dll_lua_rawset) (lua_State *L, int idx);
+#if LUA_VERSION_NUM <= 502
void (*dll_lua_rawseti) (lua_State *L, int idx, int n);
+#else
+void (*dll_lua_rawseti) (lua_State *L, int idx, lua_Integer n);
+#endif
int (*dll_lua_setmetatable) (lua_State *L, int objindex);
int (*dll_lua_next) (lua_State *L, int idx);
/* libs */