lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

strlen already returns size_t.
We can securely remove this useless cast?

diff --git a/lstrlib.c b/lstrlib.c
index 2ba8bde4..6b77f332 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1738,7 +1738,7 @@ static int str_unpack (lua_State *L) {
         break;
       }
       case Kzstr: {
-        size_t len = (int)strlen(data + pos);
+        size_t len = strlen(data + pos);
         luaL_argcheck(L, pos + len < ld, 2,
                          "unfinished string for format 'z'");
         lua_pushlstring(L, data + pos, len);

regards,
Ranier Vilela