summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_route.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@nginx.com>2022-11-02 21:45:40 +0100
committerAlejandro Colomar <alx@nginx.com>2022-11-04 00:30:50 +0100
commitebf02266a2cd663ad4744d3b8c07e211b8f38da1 (patch)
tree4d55a48c6b5ab9417f259ac04d5ad55018de8036 /src/nxt_http_route.c
parent1b05161107112f09c15b128090284bb6de5b4f70 (diff)
downloadunit-ebf02266a2cd663ad4744d3b8c07e211b8f38da1.tar.gz
unit-ebf02266a2cd663ad4744d3b8c07e211b8f38da1.tar.bz2
Removed the unsafe nxt_memchr() wrapper for memchr(3).
The casts are unnecessary, since memchr(3)'s argument is 'const void *'. It might have been necessary in the times of K&R, where 'void *' didn't exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can hide all classes of bugs by silencing most compiler warnings. The changes from nxt_memchr() to memchr(3) were scripted: $ find src/ -type f \ | grep '\.[ch]$' \ | xargs sed -i 's/nxt_memchr/memchr/' Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
Diffstat (limited to '')
-rw-r--r--src/nxt_http_route.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c
index 9aa23899..1f2fe883 100644
--- a/src/nxt_http_route.c
+++ b/src/nxt_http_route.c
@@ -1016,7 +1016,7 @@ nxt_http_route_pattern_create(nxt_task_t *task, nxt_mp_t *mp,
if (type == NXT_HTTP_ROUTE_PATTERN_EXACT) {
tmp.start = test.start;
- p = nxt_memchr(test.start, '*', test.length);
+ p = memchr(test.start, '*', test.length);
if (p == NULL) {
/* No '*' found - EXACT pattern. */
@@ -1414,7 +1414,7 @@ nxt_http_pass_segments(nxt_mp_t *mp, nxt_str_t *pass, nxt_str_t *segments,
nxt_memzero(segments, n * sizeof(nxt_str_t));
do {
- p = nxt_memchr(rest.start, '/', rest.length);
+ p = memchr(rest.start, '/', rest.length);
if (p != NULL) {
n--;