diff options
author | Victor Stinner <vstinner@python.org> | 2022-10-11 15:59:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 15:59:58 (GMT) |
commit | df3a6d9beb8a7a3fe87a6d4126384fd3e0213853 (patch) | |
tree | ddc5781df401521d304639fb41e4530f48f8a8b7 /Objects/unicodeobject.c | |
parent | 7ec2e279fea3b340f642cff888bfa45368f5ded0 (diff) | |
download | cpython-df3a6d9beb8a7a3fe87a6d4126384fd3e0213853.zip cpython-df3a6d9beb8a7a3fe87a6d4126384fd3e0213853.tar.gz cpython-df3a6d9beb8a7a3fe87a6d4126384fd3e0213853.tar.bz2 |
gh-97982: Remove asciilib_count() (#98164)
asciilib_count() is the same than ucs1lib_count(): the code is not
specialized for ASCII strings, so it's not worth it to have a
separated function. Remove asciilib_count() function.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index bd169ed..51e660a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9000,16 +9000,10 @@ PyUnicode_Count(PyObject *str, switch (kind1) { case PyUnicode_1BYTE_KIND: - if (PyUnicode_IS_ASCII(str) && PyUnicode_IS_ASCII(substr)) - result = asciilib_count( - ((const Py_UCS1*)buf1) + start, end - start, - buf2, len2, PY_SSIZE_T_MAX - ); - else - result = ucs1lib_count( - ((const Py_UCS1*)buf1) + start, end - start, - buf2, len2, PY_SSIZE_T_MAX - ); + result = ucs1lib_count( + ((const Py_UCS1*)buf1) + start, end - start, + buf2, len2, PY_SSIZE_T_MAX + ); break; case PyUnicode_2BYTE_KIND: result = ucs2lib_count( @@ -9904,10 +9898,7 @@ anylib_count(int kind, PyObject *sstr, const void* sbuf, Py_ssize_t slen, { switch (kind) { case PyUnicode_1BYTE_KIND: - if (PyUnicode_IS_ASCII(sstr) && PyUnicode_IS_ASCII(str1)) - return asciilib_count(sbuf, slen, buf1, len1, maxcount); - else - return ucs1lib_count(sbuf, slen, buf1, len1, maxcount); + return ucs1lib_count(sbuf, slen, buf1, len1, maxcount); case PyUnicode_2BYTE_KIND: return ucs2lib_count(sbuf, slen, buf1, len1, maxcount); case PyUnicode_4BYTE_KIND: |