diff options
author | Zhidao HONG <z.hong@f5.com> | 2024-01-31 14:11:29 +0800 |
---|---|---|
committer | Zhidao HONG <z.hong@f5.com> | 2024-02-20 06:09:23 +0800 |
commit | 01fd121c4e442039662889bb54ce24f21af649f0 (patch) | |
tree | 9f211758f6b40d5fc98c525588a937e4df9a74c1 | |
parent | 62894ae77b806e84e7e2c16950850f62825869c2 (diff) | |
download | unit-01fd121c4e442039662889bb54ce24f21af649f0.tar.gz unit-01fd121c4e442039662889bb54ce24f21af649f0.tar.bz2 |
Var: Refactored nxt_http_unknown_var_ref()
-rw-r--r-- | src/nxt_http_variables.c | 13 | ||||
-rw-r--r-- | src/nxt_var.c | 2 | ||||
-rw-r--r-- | src/nxt_var.h | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/nxt_http_variables.c b/src/nxt_http_variables.c index a4205eec..85ae6004 100644 --- a/src/nxt_http_variables.c +++ b/src/nxt_http_variables.c @@ -135,8 +135,7 @@ nxt_http_register_variables(void) nxt_int_t -nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, - nxt_str_t *name) +nxt_http_unknown_var_ref(nxt_mp_t *mp, nxt_var_ref_t *ref, nxt_str_t *name) { int64_t hash; nxt_str_t str, *lower; @@ -152,7 +151,7 @@ nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, return NXT_ERROR; } - lower = nxt_str_alloc(state->pool, str.length); + lower = nxt_str_alloc(mp, str.length); if (nxt_slow_path(lower == NULL)) { return NXT_ERROR; } @@ -175,7 +174,7 @@ nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, return NXT_ERROR; } - hash = nxt_http_header_hash(state->pool, &str); + hash = nxt_http_header_hash(mp, &str); if (nxt_slow_path(hash == -1)) { return NXT_ERROR; } @@ -191,7 +190,7 @@ nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, return NXT_ERROR; } - hash = nxt_http_argument_hash(state->pool, &str); + hash = nxt_http_argument_hash(mp, &str); if (nxt_slow_path(hash == -1)) { return NXT_ERROR; } @@ -207,7 +206,7 @@ nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, return NXT_ERROR; } - hash = nxt_http_cookie_hash(state->pool, &str); + hash = nxt_http_cookie_hash(mp, &str); if (nxt_slow_path(hash == -1)) { return NXT_ERROR; } @@ -216,7 +215,7 @@ nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, return NXT_ERROR; } - ref->data = nxt_var_field_new(state->pool, &str, (uint32_t) hash); + ref->data = nxt_var_field_new(mp, &str, (uint32_t) hash); if (nxt_slow_path(ref->data == NULL)) { return NXT_ERROR; } diff --git a/src/nxt_var.c b/src/nxt_var.c index e45c4f14..a297b5b3 100644 --- a/src/nxt_var.c +++ b/src/nxt_var.c @@ -141,7 +141,7 @@ nxt_var_ref_get(nxt_tstr_state_t *state, nxt_str_t *name) goto done; } - ret = nxt_http_unknown_var_ref(state, ref, name); + ret = nxt_http_unknown_var_ref(state->pool, ref, name); if (nxt_slow_path(ret != NXT_OK)) { return NULL; } diff --git a/src/nxt_var.h b/src/nxt_var.h index fde64f1e..d04ba48a 100644 --- a/src/nxt_var.h +++ b/src/nxt_var.h @@ -62,7 +62,7 @@ nxt_int_t nxt_var_interpreter(nxt_task_t *task, nxt_tstr_state_t *state, nxt_str_t *nxt_var_get(nxt_task_t *task, nxt_var_cache_t *cache, nxt_str_t *name, void *ctx); -nxt_int_t nxt_http_unknown_var_ref(nxt_tstr_state_t *state, nxt_var_ref_t *ref, +nxt_int_t nxt_http_unknown_var_ref(nxt_mp_t *mp, nxt_var_ref_t *ref, nxt_str_t *name); |