Skip to content

Commit 67403d3

Browse files
committed
change: code style.
1 parent a929065 commit 67403d3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/resty/radixtree.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ local cur_level = ngx.config.subsystem == "http" and
2525
require("ngx.errlog").get_sys_filter_level()
2626
local ngx_var = ngx.var
2727
local re_find = ngx.re.find
28+
local empty_table = {}
29+
30+
31+
setmetatable(empty_table, {__newindex = function()
32+
error("empty_table can not be changed")
33+
end})
2834

2935

3036
local function load_shared_lib(so_name)
@@ -519,6 +525,7 @@ local function match_route_opts(route, opts)
519525
return true
520526
end
521527

528+
522529
local function _match_from_routes(routes, path, opts)
523530
for _, route in ipairs(routes) do
524531
if route.path_op == "=" then
@@ -534,9 +541,11 @@ local function _match_from_routes(routes, path, opts)
534541
end
535542
end
536543
end
544+
537545
return nil
538546
end
539547

548+
540549
local function match_route(self, path, opts)
541550
local routes = self.hash_path[path]
542551
if routes then
@@ -570,7 +579,7 @@ local function match_route(self, path, opts)
570579
return nil
571580
end
572581

573-
local empty_table = {}
582+
574583
function _M.match(self, path, opts)
575584
if type(path) ~= "string" then
576585
error("invalid argument path", 2)
@@ -610,4 +619,5 @@ function _M.dispatch(self, path, opts, ...)
610619
return true
611620
end
612621

622+
613623
return _M

0 commit comments

Comments
 (0)