You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/10/09 07:58:57 UTC
[apisix] branch master updated: optimize: use table.isarray to
check whether table is an array. (#2365)
This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 87a107f optimize: use table.isarray to check whether table is an array. (#2365)
87a107f is described below
commit 87a107ff4bcfaff97562d27c54e5801a946243e0
Author: Alex Zhang <zc...@gmail.com>
AuthorDate: Fri Oct 9 15:58:40 2020 +0800
optimize: use table.isarray to check whether table is an array. (#2365)
---
apisix/core/config_local.lua | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/apisix/core/config_local.lua b/apisix/core/config_local.lua
index 42e6ae7..aa9252f 100644
--- a/apisix/core/config_local.lua
+++ b/apisix/core/config_local.lua
@@ -17,7 +17,9 @@
local log = require("apisix.core.log")
local profile = require("apisix.core.profile")
+local table = require("apisix.core.table")
local yaml = require("tinyyaml")
+
local io_open = io.open
local type = type
local str_gmatch = string.gmatch
@@ -57,16 +59,6 @@ local function is_empty_yaml_line(line)
end
-local function tab_is_array(t)
- local count = 0
- for k,v in pairs(t) do
- count = count + 1
- end
-
- return #t == count
-end
-
-
local function tinyyaml_type(t)
local mt = getmetatable(t)
if mt then
@@ -84,7 +76,7 @@ local function merge_conf(base, new_tab, ppath)
if tinyyaml_type(val) == "null" then
base[key] = nil
- elseif tab_is_array(val) then
+ elseif table.isarray(val) then
base[key] = val
else