aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_hunk.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2002-09-26 16:50:29 +0000
committerIgor Sysoev <igor@sysoev.ru>2002-09-26 16:50:29 +0000
commit170efb2b7d36e85db017e9daa25a0422aee8ce8a (patch)
tree5c97700c40be01838fee85bf22827d47ff583a91 /src/core/ngx_hunk.c
parent4879b85235795840ee0e51bacc8eee9c8759541f (diff)
downloadnginx-170efb2b7d36e85db017e9daa25a0422aee8ce8a.tar.gz
nginx-170efb2b7d36e85db017e9daa25a0422aee8ce8a.zip
nginx-0.0.1-2002-09-26-20:50:29 import
Diffstat (limited to 'src/core/ngx_hunk.c')
-rw-r--r--src/core/ngx_hunk.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index 79a8ad748..1f05dc839 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -5,13 +5,15 @@
ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
int before, int after)
{
- ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
+ ngx_hunk_t *h;
+
+ ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL);
#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
#endif
- h->pre_start = ngx_palloc(pool, size + before + after);
+ ngx_test_null(h->pre_start, ngx_palloc(pool, size + before + after), NULL);
h->start = h->pos.mem = h->last.mem = h->pre_start + before;
h->end = h->last.mem + size;
h->post_end = h->end + after;
@@ -25,7 +27,9 @@ ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
- ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
+ ngx_hunk_t *h;
+
+ ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL);
#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
@@ -42,8 +46,8 @@ ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
h->file = NULL;
} else {
- h->pre_start = h->start = h->pos.mem = h->last.mem
- = ngx_palloc(pool, size);
+ ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
+ h->start = h->pos.mem = h->last.mem = h->pre_start;
h->end = h->post_end = h->start + size;
h->type = NGX_HUNK_TEMP;
@@ -56,7 +60,9 @@ ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
- ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
+ ngx_hunk_t *h;
+
+ ngx_test_null(h, ngx_palloc(pool, sizeof(ngx_hunk_t)), NULL);
#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
@@ -74,8 +80,8 @@ ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
h->file = NULL;
} else {
- h->pre_start = h->start = h->pos.mem = h->last.mem =
- ngx_palloc(pool, size);
+ ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
+ h->start = h->pos.mem = h->last.mem = h->pre_start;
h->end = h->post_end = h->start + size;
h->type = NGX_HUNK_TEMP;