summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-12-18 22:58:27 +0100
committerAlejandro Colomar <alx.manpages@gmail.com>2022-04-26 12:38:48 +0200
commitbce0f432c402ad18718aecab227b663160682ea4 (patch)
tree01f5091fc6bf12a2deb937b5ad434b65cbe8df62 /src/nxt_router.c
parente525605d057fd923aa2728babe5b49e95d86d22b (diff)
downloadunit-bce0f432c402ad18718aecab227b663160682ea4.tar.gz
unit-bce0f432c402ad18718aecab227b663160682ea4.tar.bz2
Removed special cases for non-NXT_CONF_VALUE_ARRAY.
The previous commit added more generic APIs for handling NXT_CONF_VALUE_ARRAY and non-NXT_CONF_VALUE_ARRAY together. Modify calling code to remove special cases for arrays and non-arrays, taking special care that the path for non arrays is logically equivalent to the previous special cased code. Use the now-generic array code only.
Diffstat (limited to '')
-rw-r--r--src/nxt_router.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 52ea0f37..3a32a363 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1924,25 +1924,15 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
tls_init->tickets_conf = nxt_conf_get_path(listener,
&conf_tickets);
- if (nxt_conf_type(certificate) == NXT_CONF_ARRAY) {
- n = nxt_conf_array_elements_count(certificate);
+ n = nxt_conf_array_elements_count_or_1(certificate);
- for (i = 0; i < n; i++) {
- value = nxt_conf_get_array_element(certificate, i);
-
- nxt_assert(value != NULL);
-
- ret = nxt_router_conf_tls_insert(tmcf, value, skcf,
- tls_init, i == 0);
- if (nxt_slow_path(ret != NXT_OK)) {
- goto fail;
- }
- }
+ for (i = 0; i < n; i++) {
+ value = nxt_conf_get_array_element_or_itself(certificate,
+ i);
+ nxt_assert(value != NULL);
- } else {
- /* NXT_CONF_STRING */
- ret = nxt_router_conf_tls_insert(tmcf, certificate, skcf,
- tls_init, 1);
+ ret = nxt_router_conf_tls_insert(tmcf, value, skcf,
+ tls_init, i == 0);
if (nxt_slow_path(ret != NXT_OK)) {
goto fail;
}