Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: tml <tarantool-patches@dev.tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>
Subject: [Tarantool-patches] [PATCH 1/3] lua/errno: use lengthof helper
Date: Thu, 17 Sep 2020 16:51:19 +0300	[thread overview]
Message-ID: <20200917135121.60380-2-gorcunov@gmail.com> (raw)
In-Reply-To: <20200917135121.60380-1-gorcunov@gmail.com>

No need for ending empty entry.

Part-of #5034

Signed-off-by: Cyrill Gorcunov <gorcunov@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

  reply	other threads:[~2020-09-17 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 13:51 [Tarantool-patches] [PATCH 0/3] lua/pwd: workaround the systemd bug Cyrill Gorcunov
2020-09-17 13:51 ` Cyrill Gorcunov [this message]
2020-09-17 13:51 ` [Tarantool-patches] [PATCH 2/3] lua/errno: shrink memory usage on error declaration Cyrill Gorcunov
2020-09-17 13:51 ` [Tarantool-patches] [PATCH 3/3] lua/pwd: workaround the systemd bug Cyrill Gorcunov
2020-09-18 11:54   ` Cyrill Gorcunov
2020-09-18 12:26 ` [Tarantool-patches] [PATCH 0/3] " Kirill Yukhin
2020-09-18 12:39   ` Cyrill Gorcunov
2020-09-21  1:45 ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200917135121.60380-2-gorcunov@gmail.com \
    --to=gorcunov@gmail.com \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/3] lua/errno: use lengthof helper' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox