From: Valentin Bartenev Date: Thu, 27 Jun 2019 15:55:34 +0000 (+0300) Subject: Removed unused nalloc parameter from lvlhsh allocation functions. X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=86982b7e21ed84eac7f2de66fa4c6c91e78be063;p=njs.git Removed unused nalloc parameter from lvlhsh allocation functions. --- diff --git a/njs/njs_event.c b/njs/njs_event.c index a042b8c7..fc4c00a2 100644 --- a/njs/njs_event.c +++ b/njs/njs_event.c @@ -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, diff --git a/njs/njs_extern.c b/njs/njs_extern.c index b92a3754..f0743b7e 100644 --- a/njs/njs_extern.c +++ b/njs/njs_extern.c @@ -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, diff --git a/njs/njs_lexer_keyword.c b/njs/njs_lexer_keyword.c index afe225f2..5aa856b0 100644 --- a/njs/njs_lexer_keyword.c +++ b/njs/njs_lexer_keyword.c @@ -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, diff --git a/njs/njs_module.c b/njs/njs_module.c index 35f73725..17649c47 100644 --- a/njs/njs_module.c +++ b/njs/njs_module.c @@ -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, diff --git a/njs/njs_object.c b/njs/njs_object.c index 92e9ec87..9d80124d 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -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, diff --git a/njs/njs_shell.c b/njs/njs_shell.c index 9fcd1534..21063e49 100644 --- a/njs/njs_shell.c +++ b/njs/njs_shell.c @@ -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); } diff --git a/njs/njs_string.c b/njs/njs_string.c index dc16c7f3..ebf042c0 100644 --- a/njs/njs_string.c +++ b/njs/njs_string.c @@ -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, diff --git a/njs/njs_variable.c b/njs/njs_variable.c index 0ce7477e..7ecabbc2 100644 --- a/njs/njs_variable.c +++ b/njs/njs_variable.c @@ -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, diff --git a/njs/njs_vm.c b/njs/njs_vm.c index c3490b20..cb87bcc3 100644 --- a/njs/njs_vm.c +++ b/njs/njs_vm.c @@ -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); } diff --git a/njs/njs_vm.h b/njs/njs_vm.h index b4c168c3..19099c8f 100644 --- a/njs/njs_vm.h +++ b/njs/njs_vm.h @@ -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, diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index 99c951ea..e9f688f3 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -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, diff --git a/nxt/nxt_lvlhsh.c b/nxt/nxt_lvlhsh.c index 9cbb704e..eb4a024f 100644 --- a/nxt/nxt_lvlhsh.c +++ b/nxt/nxt_lvlhsh.c @@ -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; diff --git a/nxt/nxt_lvlhsh.h b/nxt/nxt_lvlhsh.h index 70f5a5b6..f6c2fded 100644 --- a/nxt/nxt_lvlhsh.h +++ b/nxt/nxt_lvlhsh.h @@ -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; diff --git a/nxt/test/lvlhsh_unit_test.c b/nxt/test/lvlhsh_unit_test.c index a44918c2..525cd05f 100644 --- a/nxt/test/lvlhsh_unit_test.c +++ b/nxt/test/lvlhsh_unit_test.c @@ -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,