[njs] Removed unused nalloc parameter from lvlhsh allocation functions.

Valentin Bartenev vbart at nginx.com
Thu Jun 27 15:56:22 UTC 2019


details:   https://hg.nginx.org/njs/rev/9db5e400480c
branches:  
changeset: 1019:9db5e400480c
user:      Valentin Bartenev <vbart at nginx.com>
date:      Thu Jun 27 18:55:34 2019 +0300
description:
Removed unused nalloc parameter from lvlhsh allocation functions.

diffstat:

 njs/njs_event.c             |  1 -
 njs/njs_extern.c            |  2 --
 njs/njs_lexer_keyword.c     |  1 -
 njs/njs_module.c            |  1 -
 njs/njs_object.c            |  1 -
 njs/njs_shell.c             |  5 ++---
 njs/njs_string.c            |  1 -
 njs/njs_variable.c          |  2 --
 njs/njs_vm.c                |  2 +-
 njs/njs_vm.h                |  2 +-
 njs/test/njs_unit_test.c    |  3 +--
 nxt/nxt_lvlhsh.c            |  5 ++---
 nxt/nxt_lvlhsh.h            |  6 +-----
 nxt/test/lvlhsh_unit_test.c |  3 +--
 14 files changed, 9 insertions(+), 26 deletions(-)

diffs (252 lines):

diff -r 0119e834a202 -r 9db5e400480c njs/njs_event.c
--- a/njs/njs_event.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_event.c	Thu Jun 27 18:55:34 2019 +0300
@@ -15,7 +15,6 @@ const nxt_lvlhsh_proto_t  njs_event_hash
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_event_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_extern.c
--- a/njs/njs_extern.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_extern.c	Thu Jun 27 18:55:34 2019 +0300
@@ -50,7 +50,6 @@ const nxt_lvlhsh_proto_t  njs_extern_has
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    NXT_LVLHSH_BATCH_ALLOC,
     njs_extern_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
@@ -61,7 +60,6 @@ const nxt_lvlhsh_proto_t  njs_extern_val
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    NXT_LVLHSH_BATCH_ALLOC,
     njs_extern_value_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_lexer_keyword.c
--- a/njs/njs_lexer_keyword.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_lexer_keyword.c	Thu Jun 27 18:55:34 2019 +0300
@@ -138,7 +138,6 @@ const nxt_lvlhsh_proto_t  njs_keyword_ha
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_keyword_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_module.c
--- a/njs/njs_module.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_module.c	Thu Jun 27 18:55:34 2019 +0300
@@ -415,7 +415,6 @@ const nxt_lvlhsh_proto_t  njs_modules_ha
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_module_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_object.c
--- a/njs/njs_object.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_object.c	Thu Jun 27 18:55:34 2019 +0300
@@ -149,7 +149,6 @@ const nxt_lvlhsh_proto_t  njs_object_has
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_object_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_shell.c
--- a/njs/njs_shell.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_shell.c	Thu Jun 27 18:55:34 2019 +0300
@@ -107,7 +107,7 @@ static void njs_console_clear_timer(njs_
     njs_host_event_t event);
 
 static nxt_int_t lvlhsh_key_test(nxt_lvlhsh_query_t *lhq, void *data);
-static void *lvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc);
+static void *lvlhsh_pool_alloc(void *pool, size_t size);
 static void lvlhsh_pool_free(void *pool, void *p, size_t size);
 
 
@@ -192,7 +192,6 @@ static njs_external_t  njs_externals[] =
 
 static const nxt_lvlhsh_proto_t  lvlhsh_proto  nxt_aligned(64) = {
     NXT_LVLHSH_LARGE_SLAB,
-    0,
     lvlhsh_key_test,
     lvlhsh_pool_alloc,
     lvlhsh_pool_free,
@@ -1227,7 +1226,7 @@ lvlhsh_key_test(nxt_lvlhsh_query_t *lhq,
 
 
 static void *
-lvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc)
+lvlhsh_pool_alloc(void *pool, size_t size)
 {
     return nxt_mp_align(pool, size, size);
 }
diff -r 0119e834a202 -r 9db5e400480c njs/njs_string.c
--- a/njs/njs_string.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_string.c	Thu Jun 27 18:55:34 2019 +0300
@@ -4591,7 +4591,6 @@ static const nxt_lvlhsh_proto_t  njs_val
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_values_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_variable.c
--- a/njs/njs_variable.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_variable.c	Thu Jun 27 18:55:34 2019 +0300
@@ -37,7 +37,6 @@ const nxt_lvlhsh_proto_t  njs_variables_
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_variables_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
@@ -232,7 +231,6 @@ const nxt_lvlhsh_proto_t  njs_references
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_reference_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
diff -r 0119e834a202 -r 9db5e400480c njs/njs_vm.c
--- a/njs/njs_vm.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_vm.c	Thu Jun 27 18:55:34 2019 +0300
@@ -3672,7 +3672,7 @@ njs_debug(njs_index_t index, njs_value_t
 
 
 void *
-njs_lvlhsh_alloc(void *data, size_t size, nxt_uint_t nalloc)
+njs_lvlhsh_alloc(void *data, size_t size)
 {
     return nxt_mp_align(data, size, size);
 }
diff -r 0119e834a202 -r 9db5e400480c njs/njs_vm.h
--- a/njs/njs_vm.h	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/njs_vm.h	Thu Jun 27 18:55:34 2019 +0300
@@ -1339,7 +1339,7 @@ nxt_int_t njs_builtin_match_native_funct
 
 nxt_array_t *njs_vm_backtrace(njs_vm_t *vm);
 
-void *njs_lvlhsh_alloc(void *data, size_t size, nxt_uint_t nalloc);
+void *njs_lvlhsh_alloc(void *data, size_t size);
 void njs_lvlhsh_free(void *data, void *p, size_t size);
 
 njs_array_t * njs_value_enumerate(njs_vm_t *vm, const njs_value_t *value,
diff -r 0119e834a202 -r 9db5e400480c njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/njs/test/njs_unit_test.c	Thu Jun 27 18:55:34 2019 +0300
@@ -13116,7 +13116,7 @@ lvlhsh_unit_test_key_test(nxt_lvlhsh_que
 
 
 static void *
-lvlhsh_unit_test_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc)
+lvlhsh_unit_test_pool_alloc(void *pool, size_t size)
 {
     return nxt_mp_align(pool, size, size);
 }
@@ -13131,7 +13131,6 @@ lvlhsh_unit_test_pool_free(void *pool, v
 
 static const nxt_lvlhsh_proto_t  lvlhsh_proto  nxt_aligned(64) = {
     NXT_LVLHSH_LARGE_SLAB,
-    0,
     lvlhsh_unit_test_key_test,
     lvlhsh_unit_test_pool_alloc,
     lvlhsh_unit_test_pool_free,
diff -r 0119e834a202 -r 9db5e400480c nxt/nxt_lvlhsh.c
--- a/nxt/nxt_lvlhsh.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/nxt/nxt_lvlhsh.c	Thu Jun 27 18:55:34 2019 +0300
@@ -285,8 +285,7 @@ nxt_lvlhsh_new_bucket(nxt_lvlhsh_query_t
 {
     uint32_t  *bucket;
 
-    bucket = lhq->proto->alloc(lhq->pool, nxt_lvlhsh_bucket_size(lhq->proto),
-                               lhq->proto->nalloc);
+    bucket = lhq->proto->alloc(lhq->pool, nxt_lvlhsh_bucket_size(lhq->proto));
 
     if (nxt_fast_path(bucket != NULL)) {
 
@@ -459,7 +458,7 @@ nxt_lvlhsh_convert_bucket_to_level(nxt_l
     proto = lhq->proto;
     size = nxt_lvlhsh_level_size(proto, nlvl);
 
-    lvl = proto->alloc(lhq->pool, size * (sizeof(void *)), proto->nalloc);
+    lvl = proto->alloc(lhq->pool, size * (sizeof(void *)));
 
     if (nxt_slow_path(lvl == NULL)) {
         return NXT_ERROR;
diff -r 0119e834a202 -r 9db5e400480c nxt/nxt_lvlhsh.h
--- a/nxt/nxt_lvlhsh.h	Thu Jun 27 18:54:21 2019 +0300
+++ b/nxt/nxt_lvlhsh.h	Thu Jun 27 18:55:34 2019 +0300
@@ -11,7 +11,7 @@
 typedef struct nxt_lvlhsh_query_s  nxt_lvlhsh_query_t;
 
 typedef nxt_int_t (*nxt_lvlhsh_test_t)(nxt_lvlhsh_query_t *lhq, void *data);
-typedef void *(*nxt_lvlhsh_alloc_t)(void *ctx, size_t size, nxt_uint_t nalloc);
+typedef void *(*nxt_lvlhsh_alloc_t)(void *ctx, size_t size);
 typedef void (*nxt_lvlhsh_free_t)(void *ctx, void *p, size_t size);
 
 
@@ -19,7 +19,6 @@ typedef void (*nxt_lvlhsh_free_t)(void *
 
 #define NXT_LVLHSH_DEFAULT_BUCKET_SIZE  128
 #define NXT_LVLHSH_ENTRY_SIZE           3
-#define NXT_LVLHSH_BATCH_ALLOC          16
 
 /* 3 is shift of 64-bit pointer. */
 #define NXT_LVLHSH_MEMALIGN_SHIFT       (NXT_MAX_MEMALIGN_SHIFT - 3)
@@ -28,7 +27,6 @@ typedef void (*nxt_lvlhsh_free_t)(void *
 
 #define NXT_LVLHSH_DEFAULT_BUCKET_SIZE  64
 #define NXT_LVLHSH_ENTRY_SIZE           2
-#define NXT_LVLHSH_BATCH_ALLOC          8
 
 /* 2 is shift of 32-bit pointer. */
 #define NXT_LVLHSH_MEMALIGN_SHIFT       (NXT_MAX_MEMALIGN_SHIFT - 2)
@@ -73,7 +71,6 @@ typedef struct {
     uint32_t                  bucket_size;
     uint32_t                  bucket_mask;
     uint8_t                   shift[8];
-    uint32_t                  nalloc;
 
     nxt_lvlhsh_test_t         test;
     nxt_lvlhsh_alloc_t        alloc;
@@ -88,7 +85,6 @@ typedef struct {
 
     /* The maximum allowed aligned shift. */
     uint32_t                  max_shift;
-    uint32_t                  nalloc;
 } nxt_lvlhsh_ctx_t;
 
 
diff -r 0119e834a202 -r 9db5e400480c nxt/test/lvlhsh_unit_test.c
--- a/nxt/test/lvlhsh_unit_test.c	Thu Jun 27 18:54:21 2019 +0300
+++ b/nxt/test/lvlhsh_unit_test.c	Thu Jun 27 18:55:34 2019 +0300
@@ -29,7 +29,7 @@ lvlhsh_unit_test_key_test(nxt_lvlhsh_que
 
 
 static void *
-lvlhsh_unit_test_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc)
+lvlhsh_unit_test_pool_alloc(void *pool, size_t size)
 {
     return nxt_mp_align(pool, size, size);
 }
@@ -44,7 +44,6 @@ lvlhsh_unit_test_pool_free(void *pool, v
 
 static const nxt_lvlhsh_proto_t  lvlhsh_proto  nxt_aligned(64) = {
     NXT_LVLHSH_LARGE_SLAB,
-    0,
     lvlhsh_unit_test_key_test,
     lvlhsh_unit_test_pool_alloc,
     lvlhsh_unit_test_pool_free,


More information about the nginx-devel mailing list