diff options
author | dundargoc <gocdundar@gmail.com> | 2023-09-29 14:58:48 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-05 20:19:06 +0100 |
commit | acc646ad8fc3ef11fcc63b69f3d8484e4a91accd (patch) | |
tree | 613753f19fe6f6fa45884750eb176c1517269ec2 /src/nvim/lua/stdlib.c | |
parent | c513cbf361000e6f09cd5b71b718e9de3f88904d (diff) | |
download | rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.tar.gz rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.tar.bz2 rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.zip |
refactor: the long goodbye
long is 32 bits on windows, while it is 64 bits on other architectures.
This makes the type suboptimal for a codebase meant to be
cross-platform. Replace it with more appropriate integer types.
Diffstat (limited to 'src/nvim/lua/stdlib.c')
-rw-r--r-- | src/nvim/lua/stdlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 60be771b6c..606c9878e6 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -183,8 +183,8 @@ int nlua_str_utfindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL size_t codepoints = 0, codeunits = 0; mb_utflen(s1, (size_t)idx, &codepoints, &codeunits); - lua_pushinteger(lstate, (long)codepoints); - lua_pushinteger(lstate, (long)codeunits); + lua_pushinteger(lstate, (lua_Integer)codepoints); + lua_pushinteger(lstate, (lua_Integer)codeunits); return 2; } @@ -204,7 +204,7 @@ static int nlua_str_utf_pos(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL size_t clen; for (size_t i = 0; i < s1_len && s1[i] != NUL; i += clen) { clen = (size_t)utf_ptr2len_len(s1 + i, (int)(s1_len - i)); - lua_pushinteger(lstate, (long)i + 1); + lua_pushinteger(lstate, (lua_Integer)i + 1); lua_rawseti(lstate, -2, (int)idx); idx++; } @@ -276,7 +276,7 @@ int nlua_str_byteindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL return luaL_error(lstate, "index out of range"); } - lua_pushinteger(lstate, (long)byteidx); + lua_pushinteger(lstate, (lua_Integer)byteidx); return 1; } |