changeset 930:45df22906c12

allocate aligned ngx_crc32_table_short globally
author Igor Sysoev <igor@sysoev.ru>
date Fri, 15 Dec 2006 21:31:03 +0000
parents 1adfc55bb6dc
children 87f456ff13b0
files src/core/nginx.c src/core/ngx_crc32.c src/core/ngx_crc32.h
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/nginx.c	Fri Dec 15 21:18:44 2006 +0000
+++ b/src/core/nginx.c	Fri Dec 15 21:31:03 2006 +0000
@@ -252,6 +252,12 @@
         return 1;
     }
 
+    /* ngx_crc32_init() requires ngx_cacheline_size set in ngx_os_init() */
+
+    if (ngx_crc32_init() != NGX_OK) {
+        return 1;
+    }
+
     if (ngx_add_inherited_sockets(&init_cycle) != NGX_OK) {
         return 1;
     }
@@ -283,10 +289,6 @@
 
     ngx_os_status(cycle->log);
 
-    if (ngx_crc32_init(cycle->pool) != NGX_OK) {
-        return 1;
-    }
-
     ngx_cycle = cycle;
 
     ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
--- a/src/core/ngx_crc32.c	Fri Dec 15 21:18:44 2006 +0000
+++ b/src/core/ngx_crc32.c	Fri Dec 15 21:31:03 2006 +0000
@@ -102,7 +102,7 @@
 
 
 ngx_int_t
-ngx_crc32_init(ngx_pool_t *pool)
+ngx_crc32_init(void)
 {
     void  *p;
 
@@ -113,7 +113,7 @@
         return NGX_OK;
     }
 
-    p = ngx_palloc(pool, 16 * sizeof(uint32_t) + ngx_cacheline_size);
+    p = ngx_alloc(16 * sizeof(uint32_t) + ngx_cacheline_size, ngx_cycle->log);
     if (p == NULL) {
         return NGX_ERROR;
     }
--- a/src/core/ngx_crc32.h	Fri Dec 15 21:18:44 2006 +0000
+++ b/src/core/ngx_crc32.h	Fri Dec 15 21:31:03 2006 +0000
@@ -49,7 +49,7 @@
 }
 
 
-ngx_int_t ngx_crc32_init(ngx_pool_t *pool);
+ngx_int_t ngx_crc32_init(void);
 
 
 #endif /* _NGX_CRC32_H_INCLUDED_ */