Mercurial > hg > nginx
comparison src/http/modules/ngx_http_gzip_filter.c @ 294:5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 23 Mar 2004 06:01:52 +0000 |
parents | a472bfb778b3 |
children | d71c87d11b16 |
comparison
equal
deleted
inserted
replaced
293:ec3c049681fd | 294:5cfd65b8b0a7 |
---|---|
30 | 30 |
31 off_t length; | 31 off_t length; |
32 | 32 |
33 void *preallocated; | 33 void *preallocated; |
34 char *free_mem; | 34 char *free_mem; |
35 int allocated; | 35 ngx_uint_t allocated; |
36 | 36 |
37 unsigned flush:4; | 37 unsigned flush:4; |
38 unsigned redo:1; | 38 unsigned redo:1; |
39 unsigned done:1; | 39 unsigned done:1; |
40 | 40 |
513 | 513 |
514 static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size) | 514 static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size) |
515 { | 515 { |
516 ngx_http_gzip_ctx_t *ctx = opaque; | 516 ngx_http_gzip_ctx_t *ctx = opaque; |
517 | 517 |
518 int alloc; | 518 void *p; |
519 void *p; | 519 ngx_uint_t alloc; |
520 | 520 |
521 alloc = items * size; | 521 alloc = items * size; |
522 if (alloc % 512 != 0) { | 522 if (alloc % 512 != 0) { |
523 | 523 |
524 /* we allocate 8K for zlib deflate_state (~6K) */ | 524 /* we allocate 8K for zlib deflate_state (~6K) */ |
531 p = ctx->free_mem; | 531 p = ctx->free_mem; |
532 ctx->free_mem += alloc; | 532 ctx->free_mem += alloc; |
533 ctx->allocated -= alloc; | 533 ctx->allocated -= alloc; |
534 | 534 |
535 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0, | 535 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0, |
536 "gzip alloc: n:%d s:%d a:%d p:%08X", | 536 "gzip alloc: n:%d s:%d a:%d p:" PTR_FMT, |
537 items, size, alloc, p); | 537 items, size, alloc, p); |
538 | 538 |
539 return p; | 539 return p; |
540 } | 540 } |
541 | 541 |