]> git.kaiwu.me - njs.git/commitdiff
Removed unused nalloc parameter from lvlhsh allocation functions.
authorValentin Bartenev <vbart@nginx.com>
Thu, 27 Jun 2019 15:55:34 +0000 (18:55 +0300)
committerValentin Bartenev <vbart@nginx.com>
Thu, 27 Jun 2019 15:55:34 +0000 (18:55 +0300)
14 files changed:
njs/njs_event.c
njs/njs_extern.c
njs/njs_lexer_keyword.c
njs/njs_module.c
njs/njs_object.c
njs/njs_shell.c
njs/njs_string.c
njs/njs_variable.c
njs/njs_vm.c
njs/njs_vm.h
njs/test/njs_unit_test.c
nxt/nxt_lvlhsh.c
nxt/nxt_lvlhsh.h
nxt/test/lvlhsh_unit_test.c

index a042b8c705d84fdb1730a23221ddbc7b7f7b684c..fc4c00a2138276b6f13139b981550e5e7e2ef9a0 100644 (file)
@@ -15,7 +15,6 @@ const nxt_lvlhsh_proto_t  njs_event_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_event_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index b92a3754ed51115861e0e9a40230a322303e3edc..f0743b7eee132dc9beae418a78477b32bf805e66 100644 (file)
@@ -50,7 +50,6 @@ const nxt_lvlhsh_proto_t  njs_extern_hash_proto
     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_value_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    NXT_LVLHSH_BATCH_ALLOC,
     njs_extern_value_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index afe225f2b7d6241c78205d655a97e6bc190a249d..5aa856b00a80a045af0fbb8e3029cd7f465dcef5 100644 (file)
@@ -138,7 +138,6 @@ const nxt_lvlhsh_proto_t  njs_keyword_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_keyword_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index 35f737253cdf55dbaf11a056776e806a53a74025..17649c47e7f4b37d4d6068c2f52933b301aca3f3 100644 (file)
@@ -415,7 +415,6 @@ const nxt_lvlhsh_proto_t  njs_modules_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_module_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index 92e9ec87415e958ad227a607a4d79df744c4c534..9d80124de766067c1c6cc17be42951021706d4c3 100644 (file)
@@ -149,7 +149,6 @@ const nxt_lvlhsh_proto_t  njs_object_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_object_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index 9fcd1534ae65e75a63c56ab3b3ded1f2a8345ae2..21063e49592d6cb34f43fbc8dd915c8dace74665 100644 (file)
@@ -107,7 +107,7 @@ static void njs_console_clear_timer(njs_external_ptr_t external,
     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, void *data)
 
 
 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);
 }
index dc16c7f3c912e3a461ebf883bfd01e24e0c39617..ebf042c03ae5552c405a5f088a815508c58a8fce 100644 (file)
@@ -4591,7 +4591,6 @@ static const nxt_lvlhsh_proto_t  njs_values_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_values_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index 0ce7477e1b6d9f0b76418aeeec2dc7d772489d7d..7ecabbc22ac9f76f0c0963607c4525cf4a26dce9 100644 (file)
@@ -37,7 +37,6 @@ const nxt_lvlhsh_proto_t  njs_variables_hash_proto
     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_hash_proto
     nxt_aligned(64) =
 {
     NXT_LVLHSH_DEFAULT,
-    0,
     njs_reference_hash_test,
     njs_lvlhsh_alloc,
     njs_lvlhsh_free,
index c3490b20c1202b833cba06328231ffa1d5af3398..cb87bcc39afe20615b10e849d48c13cb425c882e 100644 (file)
@@ -3672,7 +3672,7 @@ njs_debug(njs_index_t index, njs_value_t *value)
 
 
 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);
 }
index b4c168c3bfa89d7d512e9880d4519e973d648b55..19099c8fabd955fa9af92b7524d80c208e9897e1 100644 (file)
@@ -1339,7 +1339,7 @@ nxt_int_t njs_builtin_match_native_function(njs_vm_t *vm,
 
 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,
index 99c951ea428941fc391e3ad0306345effbec91bb..e9f688f318d3622a65ca3ecaf16ecd0b832f5ec8 100644 (file)
@@ -13116,7 +13116,7 @@ lvlhsh_unit_test_key_test(nxt_lvlhsh_query_t *lhq, void *data)
 
 
 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, void *p, size_t size)
 
 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,
index 9cbb704e53d6e4ec66921303fc219adb017dbb88..eb4a024fe2bd474a63237a98b403bdaa61cf1b2c 100644 (file)
@@ -285,8 +285,7 @@ nxt_lvlhsh_new_bucket(nxt_lvlhsh_query_t *lhq, void **slot)
 {
     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_lvlhsh_query_t *lhq, void **slot,
     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;
index 70f5a5b6f5dd07fa4e4128146d66ce8394a67af8..f6c2fded277318a5cb2e4469a9c2e7854acdc36d 100644 (file)
@@ -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 *ctx, void *p, size_t size);
 
 #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 *ctx, void *p, size_t size);
 
 #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;
 
 
index a44918c2741bd986459fb7402a61b3e3e60e90a4..525cd05ff492bc1df52e21bd3c9fa0ede25d1867 100644 (file)
@@ -29,7 +29,7 @@ lvlhsh_unit_test_key_test(nxt_lvlhsh_query_t *lhq, void *data)
 
 
 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, void *p, size_t size)
 
 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,