]> git.kaiwu.me - nginx.git/commitdiff
use memory optimization for i386 and amd64 only:
authorIgor Sysoev <igor@sysoev.ru>
Mon, 21 May 2007 13:49:35 +0000 (13:49 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 21 May 2007 13:49:35 +0000 (13:49 +0000)
this fixes SIGBUS in PCRE on sparc64

src/core/ngx_palloc.c

index 4288bf10acbaa4e9b2b583b66b68d17a435640b9..2e72a0f3b4fd6645b41d9839ad39f67b44900ac5 100644 (file)
@@ -97,10 +97,21 @@ ngx_palloc(ngx_pool_t *pool, size_t size)
 
         for ( ;; ) {
 
+#if (NGX_HAVE_NONALIGNED)
+
+            /*
+             * allow non-aligned memory blocks for small allocations (1, 2,
+             * or 3 bytes) and for odd length strings (struct's have aligned
+             * size)
+             */
+
             if (size < sizeof(int) || (size & 1)) {
                 m = p->last;
 
-            } else {
+            } else
+#endif
+
+            {
                 m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
             }