Replace Py_UNICODE_strchr with PyUnicode_FindChar.
This commit is contained in:
parent
d1bd7f7730
commit
5f4f4c5960
|
@ -950,7 +950,6 @@ join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
|
||||||
DialectObj *dialect = self->dialect;
|
DialectObj *dialect = self->dialect;
|
||||||
int i;
|
int i;
|
||||||
Py_ssize_t rec_len;
|
Py_ssize_t rec_len;
|
||||||
Py_UNICODE *lineterm;
|
|
||||||
|
|
||||||
#define ADDCH(c) \
|
#define ADDCH(c) \
|
||||||
do {\
|
do {\
|
||||||
|
@ -959,10 +958,6 @@ join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
|
||||||
rec_len++;\
|
rec_len++;\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
lineterm = PyUnicode_AsUnicode(dialect->lineterminator);
|
|
||||||
if (lineterm == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
rec_len = self->rec_len;
|
rec_len = self->rec_len;
|
||||||
|
|
||||||
/* If this is not the first field we need a field separator */
|
/* If this is not the first field we need a field separator */
|
||||||
|
@ -982,7 +977,9 @@ join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
|
||||||
if (c == dialect->delimiter ||
|
if (c == dialect->delimiter ||
|
||||||
c == dialect->escapechar ||
|
c == dialect->escapechar ||
|
||||||
c == dialect->quotechar ||
|
c == dialect->quotechar ||
|
||||||
Py_UNICODE_strchr(lineterm, c)) {
|
PyUnicode_FindChar(
|
||||||
|
dialect->lineterminator, c, 0,
|
||||||
|
PyUnicode_GET_LENGTH(dialect->lineterminator), 1) >= 0) {
|
||||||
if (dialect->quoting == QUOTE_NONE)
|
if (dialect->quoting == QUOTE_NONE)
|
||||||
want_escape = 1;
|
want_escape = 1;
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue