comparison src/core/ngx_palloc.c @ 1207:103988cef757

use memory optimization for i386 and amd64 only: this fixes SIGBUS in PCRE on sparc64
author Igor Sysoev <igor@sysoev.ru>
date Mon, 21 May 2007 13:49:35 +0000
parents 4d203f76b757
children 276b981ca92f
comparison
equal deleted inserted replaced
1206:451e34738078 1207:103988cef757
95 p = pool->current; 95 p = pool->current;
96 current = p; 96 current = p;
97 97
98 for ( ;; ) { 98 for ( ;; ) {
99 99
100 #if (NGX_HAVE_NONALIGNED)
101
102 /*
103 * allow non-aligned memory blocks for small allocations (1, 2,
104 * or 3 bytes) and for odd length strings (struct's have aligned
105 * size)
106 */
107
100 if (size < sizeof(int) || (size & 1)) { 108 if (size < sizeof(int) || (size & 1)) {
101 m = p->last; 109 m = p->last;
102 110
103 } else { 111 } else
112 #endif
113
114 {
104 m = ngx_align_ptr(p->last, NGX_ALIGNMENT); 115 m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
105 } 116 }
106 117
107 if ((size_t) (p->end - m) >= size) { 118 if ((size_t) (p->end - m) >= size) {
108 p->last = m + size; 119 p->last = m + size;