[Tarantool-patches] [PATCH 1/3] lua/errno: use lengthof helper
Cyrill Gorcunov
gorcunov at gmail.com
Thu Sep 17 16:51:19 MSK 2020
No need for ending empty entry.
Part-of #5034
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
src/lua/errno.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/lua/errno.c b/src/lua/errno.c
index 5c9101c64..3d3947e75 100644
--- a/src/lua/errno.c
+++ b/src/lua/errno.c
@@ -281,14 +281,13 @@ tarantool_lua_errno_init(struct lua_State *L)
#ifdef EXDEV
{ "EXDEV", EXDEV },
#endif
- { "", 0 }
};
static const luaL_Reg errnolib[] = {
{ NULL, NULL}
};
luaL_register_module(L, "errno", errnolib);
- for (int i = 0; elist[i].name[0]; i++) {
+ for (int i = 0; i < (int)lengthof(elist); i++) {
lua_pushstring(L, elist[i].name);
lua_pushinteger(L, elist[i].value);
lua_rawset(L, -3);
--
2.26.2
More information about the Tarantool-patches
mailing list