diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-12-18 22:58:27 +0100 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-04-26 12:38:48 +0200 |
commit | bce0f432c402ad18718aecab227b663160682ea4 (patch) | |
tree | 01f5091fc6bf12a2deb937b5ad434b65cbe8df62 /src/python | |
parent | e525605d057fd923aa2728babe5b49e95d86d22b (diff) | |
download | unit-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 'src/python')
-rw-r--r-- | src/python/nxt_python.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/python/nxt_python.c b/src/python/nxt_python.c index 8687c869..188c4920 100644 --- a/src/python/nxt_python.c +++ b/src/python/nxt_python.c @@ -411,15 +411,8 @@ nxt_python_set_path(nxt_task_t *task, nxt_conf_value_t *value) /* sys is a Borrowed reference. */ - if (nxt_conf_type(value) == NXT_CONF_STRING) { - n = 0; - goto value_is_string; - } - - /* NXT_CONF_ARRAY */ array = value; - - n = nxt_conf_array_elements_count(array); + n = nxt_conf_array_elements_count_or_1(array); while (n != 0) { n--; @@ -430,9 +423,7 @@ nxt_python_set_path(nxt_task_t *task, nxt_conf_value_t *value) * specified in the "path" option. */ - value = nxt_conf_get_array_element(array, n); - - value_is_string: + value = nxt_conf_get_array_element_or_itself(array, n); nxt_conf_get_string(value, &str); |