0
0
mirror of https://github.com/python/cpython.git synced 2024-12-01 11:15:56 +01:00

Replace Py_UNICODE_strchr with PyUnicode_FindChar.

This commit is contained in:
Martin v. Löwis 2011-11-01 18:42:23 +01:00
parent d1bd7f7730
commit 5f4f4c5960

View File

@ -950,7 +950,6 @@ join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
DialectObj *dialect = self->dialect;
int i;
Py_ssize_t rec_len;
Py_UNICODE *lineterm;
#define ADDCH(c) \
do {\
@ -959,10 +958,6 @@ join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
rec_len++;\
} while(0)
lineterm = PyUnicode_AsUnicode(dialect->lineterminator);
if (lineterm == NULL)
return -1;
rec_len = self->rec_len;
/* 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 ||
c == dialect->escapechar ||
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)
want_escape = 1;
else {