diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-13 09:20:34 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-13 09:20:34 -0300 |
| commit | 52aa2b5d24c560fb4d7a642971571ff9cbeabfcd (patch) | |
| tree | a95b9c94c3a526ad85ebb26f910692d93b20888b | |
| parent | cc2b66c85687b095e68304c010b59851ca4093e1 (diff) | |
| download | lua-52aa2b5d24c560fb4d7a642971571ff9cbeabfcd.tar.gz lua-52aa2b5d24c560fb4d7a642971571ff9cbeabfcd.tar.bz2 lua-52aa2b5d24c560fb4d7a642971571ff9cbeabfcd.zip | |
Details
- 'unsigned int' -> 'unsigned'
- Some explicit casts to avoid warnings
- Test avoids printing the value of 'fail' (which may not be nil)
| -rw-r--r-- | lauxlib.h | 2 | ||||
| -rw-r--r-- | ltablib.c | 2 | ||||
| -rw-r--r-- | lua.h | 3 | ||||
| -rw-r--r-- | testes/main.lua | 4 |
4 files changed, 5 insertions, 6 deletions
| @@ -100,7 +100,7 @@ LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); | |||
| 100 | 100 | ||
| 101 | LUALIB_API lua_State *(luaL_newstate) (void); | 101 | LUALIB_API lua_State *(luaL_newstate) (void); |
| 102 | 102 | ||
| 103 | LUALIB_API unsigned int luaL_makeseed (lua_State *L); | 103 | LUALIB_API unsigned luaL_makeseed (lua_State *L); |
| 104 | 104 | ||
| 105 | LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); | 105 | LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); |
| 106 | 106 | ||
| @@ -63,7 +63,7 @@ static int tcreate (lua_State *L) { | |||
| 63 | lua_Unsigned sizerest = (lua_Unsigned)luaL_optinteger(L, 2, 0); | 63 | lua_Unsigned sizerest = (lua_Unsigned)luaL_optinteger(L, 2, 0); |
| 64 | luaL_argcheck(L, sizeseq <= UINT_MAX, 1, "out of range"); | 64 | luaL_argcheck(L, sizeseq <= UINT_MAX, 1, "out of range"); |
| 65 | luaL_argcheck(L, sizerest <= UINT_MAX, 2, "out of range"); | 65 | luaL_argcheck(L, sizerest <= UINT_MAX, 2, "out of range"); |
| 66 | lua_createtable(L, sizeseq, sizerest); | 66 | lua_createtable(L, (unsigned)sizeseq, (unsigned)sizerest); |
| 67 | return 1; | 67 | return 1; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -160,8 +160,7 @@ extern const char lua_ident[]; | |||
| 160 | /* | 160 | /* |
| 161 | ** state manipulation | 161 | ** state manipulation |
| 162 | */ | 162 | */ |
| 163 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud, | 163 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud, unsigned seed); |
| 164 | unsigned int seed); | ||
| 165 | LUA_API void (lua_close) (lua_State *L); | 164 | LUA_API void (lua_close) (lua_State *L); |
| 166 | LUA_API lua_State *(lua_newthread) (lua_State *L); | 165 | LUA_API lua_State *(lua_newthread) (lua_State *L); |
| 167 | LUA_API int (lua_closethread) (lua_State *L, lua_State *from); | 166 | LUA_API int (lua_closethread) (lua_State *L, lua_State *from); |
diff --git a/testes/main.lua b/testes/main.lua index dde72a74..5c7d0a10 100644 --- a/testes/main.lua +++ b/testes/main.lua | |||
| @@ -312,7 +312,7 @@ setmetatable({}, {__gc = function () | |||
| 312 | -- this finalizer should not be called, as object will be | 312 | -- this finalizer should not be called, as object will be |
| 313 | -- created after 'lua_close' has been called | 313 | -- created after 'lua_close' has been called |
| 314 | setmetatable({}, {__gc = function () print(3) end}) | 314 | setmetatable({}, {__gc = function () print(3) end}) |
| 315 | print(collectgarbage()) -- cannot call collector here | 315 | print(collectgarbage() or false) -- cannot call collector here |
| 316 | os.exit(0, true) | 316 | os.exit(0, true) |
| 317 | end}) | 317 | end}) |
| 318 | ]] | 318 | ]] |
| @@ -322,7 +322,7 @@ creating 1 | |||
| 322 | creating 2 | 322 | creating 2 |
| 323 | 2 | 323 | 2 |
| 324 | creating 3 | 324 | creating 3 |
| 325 | nil | 325 | false |
| 326 | 1 | 326 | 1 |
| 327 | ]] | 327 | ]] |
| 328 | 328 | ||
