comparison src/core/ngx_palloc.c @ 380:bc21d9cd9c54 NGINX_0_7_2

nginx 0.7.2 *) Feature: now nginx supports EDH key exchange ciphers. *) Feature: the "ssl_dhparam" directive. *) Feature: the $ssl_client_cert variable. Thanks to Manlio Perillo. *) Bugfix: after changing URI via a "rewrite" directive nginx did not search a new location; bug appeared in 0.7.1. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built without PCRE library; bug appeared in 0.7.1. *) Bugfix: when a request to a directory was redirected with the slash added, nginx dropped a query string from the original request.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Jun 2008 00:00:00 +0400
parents b743d290eb3b
children 984bb0b1399b
comparison
equal deleted inserted replaced
379:9d9dad60269f 380:bc21d9cd9c54
97 p = pool->current; 97 p = pool->current;
98 current = p; 98 current = p;
99 99
100 for ( ;; ) { 100 for ( ;; ) {
101 101
102 #if (NGX_HAVE_NONALIGNED)
103
104 /* 102 /*
105 * allow non-aligned memory blocks for small allocations (1, 2, 103 * allow non-aligned memory blocks for small allocations (1, 2,
106 * or 3 bytes) and for odd length strings (struct's have aligned 104 * or 3 bytes) and for odd length strings (struct's have aligned
107 * size) 105 * size)
108 */ 106 */
109 107
110 if (size < sizeof(int) || (size & 1)) { 108 if (size < sizeof(int) || (size & 1)) {
111 m = p->last; 109 m = p->last;
112 110
113 } else 111 } else {
114 #endif
115
116 {
117 m = ngx_align_ptr(p->last, NGX_ALIGNMENT); 112 m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
118 } 113 }
119 114
120 if ((size_t) (p->end - m) >= size) { 115 if ((size_t) (p->end - m) >= size) {
121 p->last = m + size; 116 p->last = m + size;
172 large->alloc = p; 167 large->alloc = p;
173 large->next = pool->large; 168 large->next = pool->large;
174 pool->large = large; 169 pool->large = large;
175 170
176 return p; 171 return p;
172 }
173
174
175 void *
176 ngx_palloc_aligned(ngx_pool_t *pool, size_t size)
177 {
178 if (size & 1) {
179 size++;
180 }
181
182 return ngx_palloc(pool, size);
177 } 183 }
178 184
179 185
180 ngx_int_t 186 ngx_int_t
181 ngx_pfree(ngx_pool_t *pool, void *p) 187 ngx_pfree(ngx_pool_t *pool, void *p)