diff options
author | Alejandro Colomar <alx@nginx.com> | 2022-11-02 21:45:40 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@nginx.com> | 2022-11-04 00:30:50 +0100 |
commit | ebf02266a2cd663ad4744d3b8c07e211b8f38da1 (patch) | |
tree | 4d55a48c6b5ab9417f259ac04d5ad55018de8036 /src/perl/nxt_perl_psgi.c | |
parent | 1b05161107112f09c15b128090284bb6de5b4f70 (diff) | |
download | unit-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/perl/nxt_perl_psgi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/perl/nxt_perl_psgi.c b/src/perl/nxt_perl_psgi.c index 0c1c1222..5e8d1aee 100644 --- a/src/perl/nxt_perl_psgi.c +++ b/src/perl/nxt_perl_psgi.c @@ -765,7 +765,7 @@ nxt_perl_psgi_result_status(PerlInterpreter *my_perl, SV *result) status.start = (u_char *) SvPV(*sv_status, status.length); - space = nxt_memchr(status.start, ' ', status.length); + space = memchr(status.start, ' ', status.length); if (space != NULL) { status.length = space - status.start; } |