[Python-checkins] cpython: Replace Py_UNICODE_strchr with PyUnicode_FindChar.
martin.v.loewis
python-checkins at python.org
Wed Nov 2 00:27:59 CET 2011
http://hg.python.org/cpython/rev/d133601583d5
changeset: 73297:d133601583d5
parent: 73294:f666ecd5c2c5
user: Martin v. Löwis <martin at v.loewis.de>
date: Tue Nov 01 18:42:23 2011 +0100
summary:
Replace Py_UNICODE_strchr with PyUnicode_FindChar.
files:
Modules/_csv.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/Modules/_csv.c b/Modules/_csv.c
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -950,7 +950,6 @@
DialectObj *dialect = self->dialect;
int i;
Py_ssize_t rec_len;
- Py_UNICODE *lineterm;
#define ADDCH(c) \
do {\
@@ -959,10 +958,6 @@
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 @@
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 {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list