diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-08 15:22:46 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-08 15:22:46 (GMT) |
commit | 94f6fa62bf111916a44e336c25deeac2c490ec98 (patch) | |
tree | 520bab7fdcf7888c615f0090fc0121e07ea72727 /Objects | |
parent | 69f39a53f62734d3e8dcb4bdcc217c4b3551d393 (diff) | |
download | cpython-94f6fa62bf111916a44e336c25deeac2c490ec98.zip cpython-94f6fa62bf111916a44e336c25deeac2c490ec98.tar.gz cpython-94f6fa62bf111916a44e336c25deeac2c490ec98.tar.bz2 |
Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytes_methods.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 7233cea..ef3c2f7 100644 --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -248,12 +248,8 @@ _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len) { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISUPPER(c)) - result[i] = Py_TOLOWER(c); + result[i] = Py_TOLOWER((unsigned char) cptr[i]); } } @@ -268,12 +264,8 @@ _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len) { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISLOWER(c)) - result[i] = Py_TOUPPER(c); + result[i] = Py_TOUPPER((unsigned char) cptr[i]); } } |