Björn Svensson
ff1ef2c148
Correcting issue with multiple edges
...
When `r3_node_find_common_prefix()` searches for the common prefix it
selects the first matched edge, which might not be the best match.
This issue gives memoryleaks which can be viewed in legacy
testcase `check_tree::test_insert_pathl()` by building using:
`CFLAGS="-fno-omit-frame-pointer -fsanitize=leak" cmake ..`
See testcase procedures:
ret = r3_tree_insert_path(n, "/foo/{id}", NULL);
..
ret = r3_tree_insert_path(n, "/foo/{idx}/{idy}", NULL);
..
ret = r3_tree_insert_path(n, "/foo/{idx}/{idh}", NULL); <-- leaks
Also added a testcase that triggers the problem including a leak for
reproduction on baseline.
2021-09-20 16:55:37 +02:00
Yuansheng
1b9e007dfc
bugfix: make a try for endpoint.
2019-07-21 08:46:37 -04:00
Yuansheng
81f77ffe5a
test: added test cases.
2019-07-21 08:46:37 -04:00
Yuansheng
0d70b8f5de
bugfix: the end matching length is 0.
2019-07-21 08:46:37 -04:00
Yuansheng
db91289ab6
change: rename OP_EXPECT_NOLINEBREAKS
to OP_GREEDY_ANY
.
2019-07-20 10:52:56 -04:00
Yuansheng
d516237aab
optimize: optimized pattern .*
, which can be used prefix matching.
2019-07-20 10:52:56 -04:00
Yo-An Lin
41685d402d
Merge pull request #129 from iresty/make-warning
...
change: avoided compiling warning.
2019-07-20 18:00:48 +08:00
Yuansheng
fdc698f924
change: avoided compiling warning message.
2019-07-20 07:12:37 +08:00
Yuansheng
43666a1183
feature: supported to match http scheme.
2019-06-26 23:06:32 +08:00
Yuansheng
8e18a995d8
make: avoided the warning message when do make.
...
change: code style, delete some useless spaces(visual code).
eg:
warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
2019-06-21 10:45:54 +08:00
Yuansheng
848b8efdca
feature: supported to match remote ip address.
2019-06-19 23:36:37 -04:00
Yuansheng
4ab222a308
feature: supported wildcard match way for host.
2019-06-19 10:07:14 -04:00
Michael Steinert
b3dbf75da5
Remove zmalloc dependency
...
Zmalloc comes from Redis. It's purpose is to track total allocations so
that a maximum can be set. For more information see the following links:
https://groups.google.com/forum/#!topic/redis-db/dPRdpowqJsY
https://stackoverflow.com/questions/22729730/when-would-one-use-malloc-over-zmalloc
This allocator is slower, not needed, and conflicts with Zlib (when
linking statically). This patch removes Zmalloc in favor of the system
allocator. Application developers can still choose to override the
allocator in their applications, e.g. Jemalloc, TCMalloc, etc.
Fixes #104
2018-07-10 08:20:46 -05:00
Michael Steinert
d1c06cd3e9
Cleanup CMake build files
2018-07-05 11:43:22 -05:00
Michael Steinert
2be2a08750
Fix -Wincompatible-pointer-types warning
2018-07-05 11:43:22 -05:00
Michael Steinert
081ccb2bde
Fix issues with check_tree test
...
This patch fixes a few issues in the check_tree test:
* Fix various memory leaks in test code
* Fix a double-free in test code
* Fix a memory leak in r3_tree_compile_patterns
One memory leak remains in the library code but it isn't obvious to me
how to fix it at the moment.
2018-07-05 09:58:20 -05:00
Martijn Otto
2f96c59929
Further WIP, got the tests to link against pthread (was broken due to pkg-config not specifying -pthread as -lpthread and cmake thus not recognizing it as a library)
2018-02-24 17:45:15 +01:00
Martijn Otto
59d182b1c1
Use the generated config.h instead to enable feature macros
2018-02-21 15:57:25 +01:00
Martijn Otto
1eeff1598a
Fix declaration of memset
2018-02-21 10:04:07 +01:00
Martijn Otto
55de164023
Set the feature test macro before including the header to enable non-standard functions used by libr3
2018-02-21 09:49:54 +01:00
Martijn Otto
8d0b90f6e1
Remove unused variables
2018-02-21 09:14:31 +01:00
Martijn Otto
5cab368af2
Add extra parenthesis around branched assignments
2018-02-21 09:11:53 +01:00
Martijn Otto
021c54308a
Fix const correctness warnings
2018-02-20 18:18:43 +01:00
c9s
cefefb239a
Fix fprintf warning
2016-04-05 16:59:27 +08:00
karantin2020
9411039fce
Router match logic corrected
2016-03-26 23:32:37 +05:00
karantin2020
ffc9e8571b
Added memory files
2016-03-26 21:34:07 +05:00
karantin2020
75438ef3d3
Changed r3 memory model, made few optimizing
2016-03-22 07:23:37 +05:00
karantin2020
40e0e1c2a0
Changed slug parsing
2016-03-08 14:51:42 +05:00
karantin2020
400768394d
Added slug parser and repaired few memory leaks
2016-03-08 11:19:54 +05:00
c9s
c609003c95
optimize c flags for development/production mode
2015-11-21 10:39:49 +08:00
c9s
daee40756c
Add -O2 flag as default
2015-11-18 14:46:18 +08:00
c9s
03031e02aa
Fix r3 json writer
2015-11-18 14:27:28 +08:00
c9s
c3ef959539
Add route namespace
...
Summary:
type route now becomes R3Route
Related issue #63
2015-11-18 14:16:26 +08:00
c9s
49ffb454f7
Add namespace for node/edge structs
...
node => R3Node
edge => R3Edge
Related issue #63
2015-11-18 12:53:46 +08:00
c9s
ef55fb9cdb
Another fix for stdbool types
2015-11-17 21:43:10 +08:00
c9s
1f1ab15cdd
Fix for stdbool type
2015-11-17 21:40:21 +08:00
c9s
3808cb37aa
Move debug macros to private header files
2015-11-17 21:24:36 +08:00
c9s
973a2cb85c
Move private functions to private header files
2015-11-17 21:17:35 +08:00
c9s
e5ef80a200
Move private function to src/str.h
2015-11-17 21:13:38 +08:00
Yo-An Lin
5e6252d8a3
Merge pull request #91 from RickySu/2.0-fix
...
add include config.h
2015-11-17 21:08:25 +08:00
c9s
63577cfecc
Remove unused str_repeat function
2015-11-17 21:06:59 +08:00
Ricky Su
88dc323f7f
add include config.h
2015-11-17 20:59:17 +08:00
c9s
acb2ff1767
Move variable positions
2015-11-17 18:32:50 +08:00
c9s
cd430968ef
Add GNU likely/unlikely support
2015-11-17 18:32:50 +08:00
c9s
4ce9068963
Cache pointer of edge
2015-11-17 18:32:50 +08:00
c9s
d4850d3564
Make edges as an array
...
Fixes : #89
2015-11-17 18:32:50 +08:00
c9s
89e4517772
Fix zero-length path insertion
...
Fixes : #86 , #85
2015-11-17 16:10:26 +08:00
c9s
f795785dce
Implement faster edge branching
2015-11-17 16:08:01 +08:00
c9s
3376d1b771
Judy array is not used.
2015-11-10 19:58:28 +08:00
c9s
c18c466a9b
use 64 * 3 bytes instead of 220 bytes for combined pattern
2015-11-10 19:56:07 +08:00