[PATCH 11/11] Unit: removed a useless assignment.

Alejandro Colomar alx.manpages at gmail.com
Thu Jun 16 16:05:36 UTC 2022


On 6/16/22 03:01, Andrew Clayton wrote:
> As was pointed out by the cppcheck[0] static code analysis utility there
> was a useless assignment in nxt_unit_request_read(). The size parameter
> is passed in by value and was being modified without being used again.
> 
> [0]: https://cppcheck.sourceforge.io/

Makes sense:

$ grepc -tfd nxt_unit_request_read
./src/nxt_unit.c:3054:
ssize_t
nxt_unit_request_read(nxt_unit_request_info_t *req, void *dst, size_t size)
{
     ssize_t  buf_res, res;

     ...
         size -= res;

         dst = nxt_pointer_to(dst, res);

     } else {
         res = 0;
     }

     return buf_res + res;
}


Reviewed-by: Alejandro Colomar <alx.manpages at gmail.com>


> ---
>   src/nxt_unit.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/nxt_unit.c b/src/nxt_unit.c
> index 9baa680..fd086b2 100644
> --- a/src/nxt_unit.c
> +++ b/src/nxt_unit.c
> @@ -3076,7 +3076,6 @@ nxt_unit_request_read(nxt_unit_request_info_t *req, void *dst, size_t size)
>           }
>   
>           req->content_length -= res;
> -        size -= res;
>   
>           dst = nxt_pointer_to(dst, res);
>   

-- 
Alejandro Colomar
<http://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20220616/9f5f9c45/attachment.bin>


More information about the unit mailing list