comparison src/http/ngx_http.c @ 2039:4d8140271204

*) add ngx_palloc_aligned() to allocate explicitlty aligned memory *) allows non-aligned memory blocks for small allocations and for odd length strings on all platforms *) use ngx_palloc_aligned()
author Igor Sysoev <igor@sysoev.ru>
date Tue, 27 May 2008 09:37:40 +0000
parents c036922f6f07
children 6389d4accacf
comparison
equal deleted inserted replaced
2038:93a0d80fdce6 2039:4d8140271204
1022 q = ngx_queue_middle(locations); 1022 q = ngx_queue_middle(locations);
1023 1023
1024 lq = (ngx_http_location_queue_t *) q; 1024 lq = (ngx_http_location_queue_t *) q;
1025 len = lq->name->len - prefix; 1025 len = lq->name->len - prefix;
1026 1026
1027 node = ngx_pcalloc(cf->pool, 1027 node = ngx_palloc_aligned(cf->pool,
1028 offsetof(ngx_http_location_tree_node_t, name) + len); 1028 offsetof(ngx_http_location_tree_node_t, name) + len);
1029 if (node == NULL) { 1029 if (node == NULL) {
1030 return NULL; 1030 return NULL;
1031 } 1031 }
1032 1032
1033 node->left = NULL;
1034 node->right = NULL;
1035 node->tree = NULL;
1033 node->exact = lq->exact; 1036 node->exact = lq->exact;
1034 node->inclusive = lq->inclusive; 1037 node->inclusive = lq->inclusive;
1035 1038
1036 node->auto_redirect = (u_char) ((lq->exact && lq->exact->auto_redirect) 1039 node->auto_redirect = (u_char) ((lq->exact && lq->exact->auto_redirect)
1037 || (lq->inclusive && lq->inclusive->auto_redirect)); 1040 || (lq->inclusive && lq->inclusive->auto_redirect));