aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_hunk.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-10-27 08:53:49 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-10-27 08:53:49 +0000
commit10fc9ef77503ec4db5f5006557aeffc1939043ca (patch)
tree48dd22fcf5c6defd2960156f24a8b07757a7c6da /src/core/ngx_hunk.c
parent6414b96ebc50f42bf878aa84839921ab0aa9f4df (diff)
downloadnginx-10fc9ef77503ec4db5f5006557aeffc1939043ca.tar.gz
nginx-10fc9ef77503ec4db5f5006557aeffc1939043ca.zip
nginx-0.0.1-2003-10-27-11:53:49 import
Diffstat (limited to 'src/core/ngx_hunk.c')
-rw-r--r--src/core/ngx_hunk.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index 100bc62af..d69c0df58 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -26,6 +26,48 @@ ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
return h;
}
+
+ngx_chain_t *ngx_create_chain_of_hunks(ngx_pool_t *pool, ngx_bufs_t *bufs)
+{
+ int i;
+ char *p;
+ ngx_hunk_t *h;
+ ngx_chain_t *chain, *cl, **ll;
+
+ ngx_test_null(p, ngx_palloc(pool, bufs->num * bufs->size), NULL);
+
+ ll = &chain;
+
+ for (i = 0; i < bufs->num; i++) {
+ ngx_test_null(h, ngx_alloc_hunk(pool), NULL);
+
+ h->pos = p;
+ h->last = p;
+ h->file_pos = 0;
+ h->file_last = 0;
+
+ h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP;
+
+ h->start = p;
+ p += bufs->size;
+ h->end = p;
+
+ h->file = NULL;
+ h->shadow = NULL;
+ h->tag = 0;
+
+ ngx_test_null(cl, ngx_alloc_chain_link(pool), NULL);
+ cl->hunk = h;
+ *ll = cl;
+ ll = &cl->next;
+ }
+
+ *ll = NULL;
+
+ return chain;
+}
+
+
ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
ngx_hunk_t *h;
@@ -61,6 +103,7 @@ ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
return h;
}
+
ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
ngx_hunk_t *h;