Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-09-15 20:03:17 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2011-09-15 20:03:17 +0400
commitd7c2673d3ffb5c8c7c994a3ee385997237ed0d99 (patch)
tree76ddc7f172a5ca4163110f259e38e30da4521ee6 /src/core/ngx_buf.c
parenta890b313f34bdcd6f95e40c75084f6ea5dd8a53c (diff)
API change: ngx_chain_update_chains() now requires pool.
The ngx_chain_update_chains() needs pool to free chain links used for buffers with non-matching tags. Providing one helps to reduce memory consumption for long-lived requests.
Diffstat (limited to 'src/core/ngx_buf.c')
-rw-r--r--src/core/ngx_buf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index 2f2c43721..53cd50cea 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -180,7 +180,7 @@ ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free)
void
-ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
+ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy,
ngx_chain_t **out, ngx_buf_tag_t tag)
{
ngx_chain_t *cl;
@@ -197,19 +197,21 @@ ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
*out = NULL;
while (*busy) {
- if (ngx_buf_size((*busy)->buf) != 0) {
+ cl = *busy;
+
+ if (ngx_buf_size(cl->buf) != 0) {
break;
}
- if ((*busy)->buf->tag != tag) {
- *busy = (*busy)->next;
+ if (cl->buf->tag != tag) {
+ *busy = cl->next;
+ ngx_free_chain(p, cl);
continue;
}
- (*busy)->buf->pos = (*busy)->buf->start;
- (*busy)->buf->last = (*busy)->buf->start;
+ cl->buf->pos = cl->buf->start;
+ cl->buf->last = cl->buf->start;
- cl = *busy;
*busy = cl->next;
cl->next = *free;
*free = cl;