diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-23 22:00:25 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-23 22:00:25 (GMT) |
commit | 2844a7a6d346927894222f51e691b783fa5039bd (patch) | |
tree | cdab4893793f1fcb9794a3c06772aa8c228239ff /Objects | |
parent | ece58deb9fd72674b84ef7a01c944b5eed6b37a1 (diff) | |
download | cpython-2844a7a6d346927894222f51e691b783fa5039bd.zip cpython-2844a7a6d346927894222f51e691b783fa5039bd.tar.gz cpython-2844a7a6d346927894222f51e691b783fa5039bd.tar.bz2 |
simplify and reformat
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2b90cfa..95ecfe2 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1975,16 +1975,18 @@ _PyUnicode_FindMaxChar(PyObject *unicode, Py_ssize_t start, Py_ssize_t end) return 127; kind = PyUnicode_KIND(unicode); - startptr = PyUnicode_DATA(unicode); - endptr = (char*)startptr + end * kind; - if (start) - startptr = (char*)startptr + start * kind; - switch(kind) - { - case PyUnicode_1BYTE_KIND: return ucs1lib_find_max_char(startptr, endptr); - case PyUnicode_2BYTE_KIND: return ucs2lib_find_max_char(startptr, endptr); + startptr = PyUnicode_DATA(unicode) + start * kind; + endptr = startptr + end * kind; + switch(kind) { + case PyUnicode_1BYTE_KIND: + return ucs1lib_find_max_char(startptr, endptr); + case PyUnicode_2BYTE_KIND: + return ucs2lib_find_max_char(startptr, endptr); + case PyUnicode_4BYTE_KIND: + return ucs4lib_find_max_char(startptr, endptr); default: - case PyUnicode_4BYTE_KIND: return ucs4lib_find_max_char(startptr, endptr); + assert(0); + return 0; } } |