From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 64B1E469719 for ; Thu, 17 Sep 2020 16:51:38 +0300 (MSK) Received: by mail-lf1-f68.google.com with SMTP id d15so2245487lfq.11 for ; Thu, 17 Sep 2020 06:51:38 -0700 (PDT) From: Cyrill Gorcunov Date: Thu, 17 Sep 2020 16:51:19 +0300 Message-Id: <20200917135121.60380-2-gorcunov@gmail.com> In-Reply-To: <20200917135121.60380-1-gorcunov@gmail.com> References: <20200917135121.60380-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/3] lua/errno: use lengthof helper List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Cc: Alexander Turenko No need for ending empty entry. Part-of #5034 Signed-off-by: Cyrill Gorcunov --- 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