[PATCH] Gzip: avoid unnecessary assignment
Maxim Dounin
mdounin at mdounin.ru
Sun Aug 3 20:40:23 UTC 2014
Hello!
On Fri, Aug 01, 2014 at 08:40:12PM -0700, Piotr Sikora wrote:
> # HG changeset patch
> # User Piotr Sikora <piotr at cloudflare.com>
> # Date 1406950763 25200
> # Fri Aug 01 20:39:23 2014 -0700
> # Node ID 78c35623c5fa444e8ce7a3af5999477a117f79be
> # Parent f87afb46ccd26fccc7ed55ca8a7ef89c6256c3f2
> Gzip: avoid unnecessary assignment.
>
> This change makes it consistent with other custom memory allocators
> provided for zlib.
>
> Signed-off-by: Piotr Sikora <piotr at cloudflare.com>
>
> diff -r f87afb46ccd2 -r 78c35623c5fa src/http/modules/ngx_http_gzip_filter_module.c
> --- a/src/http/modules/ngx_http_gzip_filter_module.c Fri Aug 01 20:04:14 2014 +0900
> +++ b/src/http/modules/ngx_http_gzip_filter_module.c Fri Aug 01 20:39:23 2014 -0700
> @@ -1013,9 +1013,7 @@ ngx_http_gzip_filter_alloc(void *opaque,
> "gzip filter failed to use preallocated memory: %ud of %ud",
> items * size, ctx->allocated);
>
> - p = ngx_palloc(ctx->request->pool, items * size);
> -
> - return p;
> + return ngx_palloc(ctx->request->pool, items * size);
> }
I prefer to keep current code as is. In particular, because it
allows to add debug logging of the address allocated without
additional changes.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list