[PATCH] Style: use ngx_calloc_buf()

Tatsuhiko Kubo cubicdaiya at gmail.com
Sat Aug 2 16:50:17 UTC 2014


# 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;
         }
@@ -217,7 +217,7 @@ ngx_http_flv_handler(ngx_http_request_t 
     }
 
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
diff -r f87afb46ccd2 -r cca43437e50a 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	Sun Aug 03 01:24:38 2014 +0900
@@ -638,7 +638,7 @@ ngx_http_gzip_filter_gzheader(ngx_http_r
     static u_char  gzheader[10] =
                                { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_ERROR;
     }
diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_gzip_static_module.c
--- a/src/http/modules/ngx_http_gzip_static_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/modules/ngx_http_gzip_static_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -248,7 +248,7 @@ ngx_http_gzip_static_handler(ngx_http_re
 
     /* we need to allocate all before the header would be sent */
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_image_filter_module.c
--- a/src/http/modules/ngx_http_image_filter_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/modules/ngx_http_image_filter_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -561,7 +561,7 @@ ngx_http_image_json(ngx_http_request_t *
     size_t      len;
     ngx_buf_t  *b;
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NULL;
     }
@@ -613,7 +613,7 @@ ngx_http_image_asis(ngx_http_request_t *
 {
     ngx_buf_t  *b;
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NULL;
     }
@@ -997,7 +997,7 @@ transparent:
         return NULL;
     }
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         gdFree(out);
         return NULL;
diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_mp4_module.c
--- a/src/http/modules/ngx_http_mp4_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/modules/ngx_http_mp4_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -646,7 +646,7 @@ ngx_http_mp4_handler(ngx_http_request_t 
     }
 
     if (mp4 == NULL) {
-        b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+        b = ngx_calloc_buf(r->pool);
         if (b == NULL) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
         }
diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_static_module.c
--- a/src/http/modules/ngx_http_static_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/modules/ngx_http_static_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -236,7 +236,7 @@ ngx_http_static_handler(ngx_http_request
 
     /* we need to allocate all before the header would be sent */
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
diff -r f87afb46ccd2 -r cca43437e50a src/http/modules/ngx_http_xslt_filter_module.c
--- a/src/http/modules/ngx_http_xslt_filter_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/modules/ngx_http_xslt_filter_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -584,7 +584,7 @@ ngx_http_xslt_apply_stylesheet(ngx_http_
         return NULL;
     }
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         ngx_free(buf);
         return NULL;
diff -r f87afb46ccd2 -r cca43437e50a src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/ngx_http_core_module.c	Sun Aug 03 01:24:38 2014 +0900
@@ -1945,7 +1945,7 @@ ngx_http_send_response(ngx_http_request_
         return ngx_http_send_header(r);
     }
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
diff -r f87afb46ccd2 -r cca43437e50a src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/http/ngx_http_file_cache.c	Sun Aug 03 01:24:38 2014 +0900
@@ -1120,7 +1120,7 @@ ngx_http_cache_send(ngx_http_request_t *
 
     /* we need to allocate all before the header would be sent */
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }



More information about the nginx-devel mailing list