|
| 1 | +--- lua/lauxlib.c |
| 2 | ++++ lua/lauxlib.c |
| 3 | +@@ -1046,7 +1046,10 @@ LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, |
| 4 | + } |
| 5 | + |
| 6 | + |
| 7 | +-void *luaL_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { |
| 8 | ++LUALIB_API LUA_HEAP_PTR_T *luaL_alloc (void *ud, |
| 9 | ++ LUA_HEAP_PTR_T *ptr, |
| 10 | ++ LUA_HEAP_SIZE_T osize, |
| 11 | ++ LUA_HEAP_SIZE_T nsize) { |
| 12 | + UNUSED(ud); UNUSED(osize); |
| 13 | + if (nsize == 0) { |
| 14 | + free(ptr); |
| 15 | + |
| 16 | +--- lua/lauxlib.h |
| 17 | ++++ lua/lauxlib.h |
| 18 | +@@ -81,8 +81,9 @@ LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, |
| 19 | + LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); |
| 20 | + LUALIB_API int (luaL_execresult) (lua_State *L, int stat); |
| 21 | + |
| 22 | +-LUALIB_API void *luaL_alloc (void *ud, void *ptr, size_t osize, |
| 23 | +- size_t nsize); |
| 24 | ++LUALIB_API LUA_HEAP_PTR_T *luaL_alloc (void *ud, LUA_HEAP_PTR_T *ptr, |
| 25 | ++ LUA_HEAP_SIZE_T osize, |
| 26 | ++ LUA_HEAP_SIZE_T nsize); |
| 27 | + |
| 28 | + |
| 29 | + /* predefined references */ |
1 | 30 | --- lua/lopcodes.h |
2 | 31 | +++ lua/lopcodes.h |
3 | 32 | @@ -78,8 +78,9 @@ enum OpMode {iABC, ivABC, iABx, iAsBx, iAx, isJ}; |
|
92 | 121 | #else |
93 | 122 | #define l_system(cmd) system(cmd) /* default definition */ |
94 | 123 | #endif |
| 124 | + |
95 | 125 | --- lua/luaconf.h |
96 | 126 | +++ lua/luaconf.h |
97 | 127 | @@ -95,7 +95,12 @@ |
|
161 | 191 | #define LUA_DIRSEP "\\" |
162 | 192 | #else |
163 | 193 | #define LUA_DIRSEP "/" |
| 194 | +@@ -739,7 +770,18 @@ |
| 195 | + ** without modifying the main part of the file. |
| 196 | + */ |
| 197 | + |
| 198 | ++/* |
| 199 | ++** Definitions for unusual types and keywords such as _huge void |
| 200 | ++** If not defined by this point then fallback to using Luas defaults |
| 201 | ++*/ |
| 202 | + |
| 203 | ++#ifndef LUA_HEAP_PTR_T |
| 204 | ++#define LUA_HEAP_PTR_T void |
| 205 | ++#endif |
| 206 | ++ |
| 207 | ++#ifndef LUA_HEAP_SIZE_T |
| 208 | ++#define LUA_HEAP_SIZE_T size_t |
| 209 | ++#endif |
| 210 | + |
| 211 | + #endif |
| 212 | + |
0 commit comments