]> git.kaiwu.me - nginx.git/commitdiff
allocate aligned ngx_crc32_table_short globally
authorIgor Sysoev <igor@sysoev.ru>
Fri, 15 Dec 2006 21:31:03 +0000 (21:31 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 15 Dec 2006 21:31:03 +0000 (21:31 +0000)
src/core/nginx.c
src/core/ngx_crc32.c
src/core/ngx_crc32.h

index 83b088ba8c8eefc0b99690fe0ecaac25d8fa16fb..2de666aa7efd731ff1a5975393edc3895648f964 100644 (file)
@@ -252,6 +252,12 @@ main(int argc, char *const *argv)
         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 @@ main(int argc, char *const *argv)
 
     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);
index ac375b06fd08fcc752d4ce97051a3f19d26ce2d8..4ad8ff3a47dbbba6b345e6fe40577d50d18f154f 100644 (file)
@@ -102,7 +102,7 @@ uint32_t *ngx_crc32_table_short = ngx_crc32_table16;
 
 
 ngx_int_t
-ngx_crc32_init(ngx_pool_t *pool)
+ngx_crc32_init(void)
 {
     void  *p;
 
@@ -113,7 +113,7 @@ ngx_crc32_init(ngx_pool_t *pool)
         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;
     }
index 7c1827933a508fa82fe54208b9c77e0b80a682af..7d5279d36fd8e41d26076336b32d289f90ad3fd5 100644 (file)
@@ -49,7 +49,7 @@ ngx_crc32_long(u_char *p, size_t len)
 }
 
 
-ngx_int_t ngx_crc32_init(ngx_pool_t *pool);
+ngx_int_t ngx_crc32_init(void);
 
 
 #endif /* _NGX_CRC32_H_INCLUDED_ */