Python: Do nxt_unit_sptr_get() earlier in nxt_python_field_value().

This is a preparatory patch for fixing an issue with the encoding of
http header field values.

This patch simply moves the nxt_unit_sptr_get() to the top of the
function where we will need it in the next commit.

Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
Andrew Clayton 2023-05-26 20:51:35 +01:00
parent 0b85fe29f7
commit dd0c53a77d

View file

@ -863,6 +863,8 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
char *p, *src;
PyObject *res;
src = nxt_unit_sptr_get(&f->value);
#if PY_MAJOR_VERSION == 3
res = PyUnicode_New(vl, 255);
#else
@ -875,7 +877,6 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
p = PyString_AS_STRING(res);
src = nxt_unit_sptr_get(&f->value);
p = nxt_cpymem(p, src, f->value_length);
for (i = 1; i < n; i++) {