X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fdispatcher.lua;h=0162407cd54bc3d936d2002f80bf0b2009417756;hp=e29bd52bc8e240c70c9566332c43e0b40fcb82f8;hb=b3861e0ec70ad94f925f196564e6a20e509ab9c4;hpb=69ba2e55a130a86ebd8988ab404a91e42a27dac9 diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index e29bd52bc8..0162407cd5 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -612,28 +612,23 @@ function node(...) return c end -function _create_node(path, cache) +function _create_node(path) if #path == 0 then return context.tree end - cache = cache or context.treecache local name = table.concat(path, ".") - local c = cache[name] + local c = context.treecache[name] if not c then - local new = {nodes={}, auto=true, path=util.clone(path)} local last = table.remove(path) + local parent = _create_node(path) - c = _create_node(path, cache) - - c.nodes[last] = new - cache[name] = new - - return new - else - return c + c = {nodes={}, auto=true} + parent.nodes[last] = c + context.treecache[name] = c end + return c end -- Subdispatchers --