comparison src/core/ngx_hunk.c @ 160:e7e094d34162

nginx-0.0.1-2003-10-27-11:53:49 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 27 Oct 2003 08:53:49 +0000
parents 46eb23d9471d
children 389d7ee9fa60
comparison
equal deleted inserted replaced
159:981e4af2a425 160:e7e094d34162
23 23
24 h->tag = 0; 24 h->tag = 0;
25 25
26 return h; 26 return h;
27 } 27 }
28
29
30 ngx_chain_t *ngx_create_chain_of_hunks(ngx_pool_t *pool, ngx_bufs_t *bufs)
31 {
32 int i;
33 char *p;
34 ngx_hunk_t *h;
35 ngx_chain_t *chain, *cl, **ll;
36
37 ngx_test_null(p, ngx_palloc(pool, bufs->num * bufs->size), NULL);
38
39 ll = &chain;
40
41 for (i = 0; i < bufs->num; i++) {
42 ngx_test_null(h, ngx_alloc_hunk(pool), NULL);
43
44 h->pos = p;
45 h->last = p;
46 h->file_pos = 0;
47 h->file_last = 0;
48
49 h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP;
50
51 h->start = p;
52 p += bufs->size;
53 h->end = p;
54
55 h->file = NULL;
56 h->shadow = NULL;
57 h->tag = 0;
58
59 ngx_test_null(cl, ngx_alloc_chain_link(pool), NULL);
60 cl->hunk = h;
61 *ll = cl;
62 ll = &cl->next;
63 }
64
65 *ll = NULL;
66
67 return chain;
68 }
69
28 70
29 ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) 71 ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
30 { 72 {
31 ngx_hunk_t *h; 73 ngx_hunk_t *h;
32 74
58 h->tag = 0; 100 h->tag = 0;
59 } 101 }
60 102
61 return h; 103 return h;
62 } 104 }
105
63 106
64 ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) 107 ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
65 { 108 {
66 ngx_hunk_t *h; 109 ngx_hunk_t *h;
67 110