Björn Svensson
2c06b8d750
Fix Clang compiler warnings
...
When building using a newer Clang with additional diagnostics
the following warnings are given:
-Wunused-but-set-variable
-Wstrict-prototypes
These issues are corrected in this commit.
Reproducable using:
CC="clang-13" CFLAGS="-Wall -pedantic" cmake ..
2023-10-26 12:24:50 +02:00
Bjorn Svensson
9b69f38527
Fix leak in r3_tree_insert_pathl_ex() ( #150 )
...
Includes a testcase triggering the issue when building with
the leak sanitizer.
Resource leak (CID 355063) found by Coverity,
2022-07-20 13:23:45 +02:00
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
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
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
karantin2020
75438ef3d3
Changed r3 memory model, made few optimizing
2016-03-22 07:23:37 +05: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
b0971e1553
Fix include
2015-11-17 21:35:18 +08:00
c9s
973a2cb85c
Move private functions to private header files
2015-11-17 21:17:35 +08:00
c9s
89e4517772
Fix zero-length path insertion
...
Fixes : #86 , #85
2015-11-17 16:10:26 +08:00
c9s
2f3bcb7116
refactoring testcase group
2015-11-17 15:37:10 +08:00
c9s
5f39b73211
Add test_root_match test case
2015-10-18 07:39:50 +08:00
c9s
98f27dadc9
test matched route data
2014-06-12 18:52:56 +08:00
c9s
5137d4d8e4
simplify functions to macro
2014-06-04 23:13:08 +08:00
c9s
5609fd5f9e
r3 function prefix
...
- Remove ltrim_slash.
- Add "r3_" prefix to r3_str.c functions.
2014-06-03 20:50:19 +08:00
c9s
67366bf688
fix warnings
2014-06-03 18:23:28 +08:00
Pedro
7c7e8b22e4
update assert statement
2014-06-03 02:13:52 +08:00
c9s
af5a89b3ea
Add test_insert_pathl_fail test
2014-06-02 16:20:02 +08:00
c9s
712767c5b6
Add more errstr pointer check
2014-06-02 16:15:44 +08:00
c9s
ea7fa973cd
Add SAFE_FREE for char * errstr
2014-06-02 16:12:27 +08:00
c9s
1f21ea19a8
Add char ** errstr to r3_node_find_common_prefix
2014-06-02 15:52:40 +08:00
c9s
f2c8005707
Test failing test case
2014-06-02 09:51:42 +08:00
c9s
2465ee4ffe
fix all tests
2014-06-02 09:49:13 +08:00
c9s
9441f974de
test compile fail
2014-06-02 09:48:00 +08:00
c9s
fd1e5f7f50
Add r3_node_find_common_prefix test cases
2014-06-02 09:09:41 +08:00
c9s
b4ce60de59
separate check_str_array test cases
2014-06-02 08:13:19 +08:00
c9s
f3bf32b922
refactor path insert function
2014-06-02 08:04:57 +08:00
c9s
f5221fd5c9
another test path
2014-06-02 07:14:16 +08:00
c9s
aace74f7a5
more paths tests
2014-06-02 07:13:47 +08:00
c9s
9271f0bf08
free the variable
2014-06-02 06:50:24 +08:00
c9s
d120389415
more path tests
2014-06-02 06:40:27 +08:00
c9s
17b4201197
more incomplete slug pattern tests
2014-06-02 06:38:50 +08:00
c9s
7d69e79535
gvc fix
2014-06-01 14:53:12 +08:00
c9s
2df5c11d09
use ck_assert
2014-06-01 02:29:12 +08:00
c9s
a946a79223
include assert.h
2014-06-01 02:28:58 +08:00
c9s
4c26995e41
assert errno == NULL
2014-06-01 02:13:38 +08:00
c9s
f670f08639
update error code for compile function
2014-06-01 02:08:16 +08:00
c9s
1a4eb14a05
error code support
...
- return error code if compilation error occurs
- use asprintf to sprint errstr
2014-06-01 02:03:44 +08:00
c9s
9433e2192a
route api improvement
2014-05-31 19:56:46 +08:00
c9s
7aaed3e5d7
merge str_array.h
2014-05-26 21:39:36 +08:00
c9s
b394be57cb
support simple opcode
2014-05-23 16:18:58 +08:00
c9s
333fabd795
insert path for opcode
2014-05-23 16:18:58 +08:00
c9s
7d16413cb3
more benchmark result
2014-05-23 16:18:57 +08:00
c9s
15facc82cc
Merge branch 'feature/asan' of https://github.com/czchen/r3 into czchen-feature/asan
...
Conflicts:
.travis.yml
2014-05-22 22:07:52 +08:00
ChangZhuo Chen (陳昌倬)
fef3361ed2
Set test timeout to 30
2014-05-22 22:06:11 +08:00
c9s
fc1a4b762d
Separate benchmark application
2014-05-22 21:55:41 +08:00
c9s
ce1f3cdc3f
Update legend style
2014-05-22 21:44:31 +08:00
c9s
fa6a7b77e0
Add pcre_benchmark test case
2014-05-22 21:18:17 +08:00