[PATCH] Style: use ngx_calloc_buf()

Maxim Dounin mdounin at mdounin.ru
Sun Aug 3 22:07:00 UTC 2014


Hello!

On Sun, Aug 03, 2014 at 01:50:17AM +0900, Tatsuhiko Kubo wrote:

> # HG changeset patch
> # User Tatsuhiko Kubo <cubicdaiya at gmail.com>
> # Date 1406996678 -32400
> #      Sun Aug 03 01:24:38 2014 +0900
> # Node ID cca43437e50ab2581e857479b287ceb8c20606a4
> # Parent  f87afb46ccd26fccc7ed55ca8a7ef89c6256c3f2
> Style: use ngx_calloc_buf().
> 
> diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_flv_module.c
> --- a/src/http/modules/ngx_http_flv_module.c	Fri Aug 01 20:04:14 2014 +0900
> +++ b/src/http/modules/ngx_http_flv_module.c	Sun Aug 03 01:24:38 2014 +0900
> @@ -203,7 +203,7 @@ ngx_http_flv_handler(ngx_http_request_t 
>      }
>  
>      if (i == 0) {
> -        b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
> +        b = ngx_calloc_buf(r->pool);
>          if (b == NULL) {
>              return NGX_HTTP_INTERNAL_SERVER_ERROR;
>          }

[...]

I don't think that this change is needed.  There is almost no 
difference between ngx_pcalloc(sizeof(ngx_buf_t)) and 
ngx_calloc_buf() even from style point of view, and both are 
usable if appropriate.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list