@@ -114,7 +114,7 @@ ffi_cdef[[
114114 void *radix_tree_find(void *t, const unsigned char *buf, size_t len);
115115 void *radix_tree_search(void *t, void *it, const unsigned char *buf,
116116 size_t len);
117- int radix_tree_pcre (void *it, const unsigned char *buf, size_t len);
117+ int radix_tree_prev (void *it, const unsigned char *buf, size_t len);
118118 int radix_tree_stop(void *it);
119119
120120 void *radix_tree_new_it(void *t);
131131
132132local _M = { _VERSION = 1.7 }
133133
134+ -- expose radix tree api for test
135+ _M ._symbols = radix
136+
134137
135138local function has_suffix (s , suffix )
136139 if type (s ) ~= " string" or type (suffix ) ~= " string" then
@@ -216,7 +219,7 @@ local function insert_route(self, opts)
216219 end
217220
218221 local data_idx = radix .radix_tree_find (self .tree , path , # path )
219- if data_idx then
222+ if data_idx ~= nil then
220223 local idx = tonumber (ffi_cast (' intptr_t' , data_idx ))
221224 local routes = self .match_data [idx ]
222225 if routes and routes [1 ].path == path then
@@ -644,7 +647,7 @@ local function match_route(self, path, opts, args)
644647 end
645648
646649 while true do
647- local idx = radix .radix_tree_pcre (it , path , # path )
650+ local idx = radix .radix_tree_prev (it , path , # path )
648651 if idx <= 0 then
649652 break
650653 end
0 commit comments