]> git.kaiwu.me - nginx.git/commitdiff
Use ngx_calloc_buf() where appropriate.
authorRuslan Ermilov <ru@nginx.com>
Wed, 12 Apr 2017 19:21:04 +0000 (22:21 +0300)
committerRuslan Ermilov <ru@nginx.com>
Wed, 12 Apr 2017 19:21:04 +0000 (22:21 +0300)
src/http/modules/ngx_http_flv_module.c
src/http/modules/ngx_http_gzip_filter_module.c
src/http/modules/ngx_http_gzip_static_module.c
src/http/modules/ngx_http_image_filter_module.c
src/http/modules/ngx_http_mp4_module.c
src/http/modules/ngx_http_static_module.c
src/http/modules/ngx_http_xslt_filter_module.c
src/http/ngx_http_core_module.c
src/http/ngx_http_file_cache.c

index cc2532027cc207901925c507e80daa3c1c7c311c..7b72fae0337d113f2103f62a053657479e73ae29 100644 (file)
@@ -203,7 +203,7 @@ ngx_http_flv_handler(ngx_http_request_t *r)
     }
 
     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 *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;
     }
index f9652d0542436ea46f07fbd388f7e63a25f77942..287fd3674aba5b0797fde4aa823166db3c5f2a9b 100644 (file)
@@ -644,7 +644,7 @@ ngx_http_gzip_filter_gzheader(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
     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;
     }
index b9294dd9454d254e480f686705ca666da041e09c..1d87cd4eff40ee806a9f4c45d1a11c02386cfaf3 100644 (file)
@@ -248,7 +248,7 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
 
     /* 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;
     }
index dbec5d8e5adc00a2cd3116792061b6f7ffe7e324..6c03e8aecec9d659edfe9378586434e479927855 100644 (file)
@@ -581,7 +581,7 @@ ngx_http_image_json(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
     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;
     }
@@ -633,7 +633,7 @@ ngx_http_image_asis(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
 {
     ngx_buf_t  *b;
 
-    b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+    b = ngx_calloc_buf(r->pool);
     if (b == NULL) {
         return NULL;
     }
@@ -1067,7 +1067,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;
index f3c0fddb9d5d188ff169301a45c8df48dd1260eb..08a68d07b23b10d40885e65bf6a8f8a1214a4209 100644 (file)
@@ -636,7 +636,7 @@ ngx_http_mp4_handler(ngx_http_request_t *r)
     }
 
     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;
         }
index f2435a78db064e85dd8f1f72d2e1fcc2ede36c26..b0513be1cad2f67023b00c50e58a0f013a35edf9 100644 (file)
@@ -233,7 +233,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
 
     /* 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;
     }
index 695f3bfda7f671fa16c561758ee1941e1d47b7e8..fae5895508c9442391321b43231e0b2917334b87 100644 (file)
@@ -584,7 +584,7 @@ ngx_http_xslt_apply_stylesheet(ngx_http_request_t *r,
         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;
index 292671d130081cc2ee3ceb179b5ec5b448f73f34..38df6ac1f0642ee82c951d6721e73d6c2b625011 100644 (file)
@@ -1926,7 +1926,7 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
         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;
     }
index 8c75f95f94cb282e70e4d56115d6ef697bb9bfc3..b635b354ef6d8072eea60d06f4cba8fa2e9cf0d4 100644 (file)
@@ -1577,7 +1577,7 @@ ngx_http_cache_send(ngx_http_request_t *r)
 
     /* 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;
     }