diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-11-01 17:42:23 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-11-01 17:42:23 (GMT) |
commit | 5f4f4c596089921e2a1bd53b01cf673cfdad1397 (patch) | |
tree | 633cb766fd2eb88b0752968aabba5f535dd9f73f /Modules/_csv.c | |
parent | d1bd7f77303d08652b5f67c7385125c3d0ec9209 (diff) | |
download | cpython-5f4f4c596089921e2a1bd53b01cf673cfdad1397.zip cpython-5f4f4c596089921e2a1bd53b01cf673cfdad1397.tar.gz cpython-5f4f4c596089921e2a1bd53b01cf673cfdad1397.tar.bz2 |
Replace Py_UNICODE_strchr with PyUnicode_FindChar.
Diffstat (limited to 'Modules/_csv.c')
-rw-r--r-- | Modules/_csv.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c index 627c3b1..c02ee38 100644 --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -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 { |