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:
@@ -863,6 +863,8 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
|
|||||||
char *p, *src;
|
char *p, *src;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
|
||||||
|
src = nxt_unit_sptr_get(&f->value);
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION == 3
|
#if PY_MAJOR_VERSION == 3
|
||||||
res = PyUnicode_New(vl, 255);
|
res = PyUnicode_New(vl, 255);
|
||||||
#else
|
#else
|
||||||
@@ -875,7 +877,6 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
|
|||||||
|
|
||||||
p = PyString_AS_STRING(res);
|
p = PyString_AS_STRING(res);
|
||||||
|
|
||||||
src = nxt_unit_sptr_get(&f->value);
|
|
||||||
p = nxt_cpymem(p, src, f->value_length);
|
p = nxt_cpymem(p, src, f->value_length);
|
||||||
|
|
||||||
for (i = 1; i < n; i++) {
|
for (i = 1; i < n; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user