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/stringlib | |
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/stringlib')
-rw-r--r-- | Objects/stringlib/count.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/stringlib/count.h b/Objects/stringlib/count.h index f48500b..e20edcd 100644 --- a/Objects/stringlib/count.h +++ b/Objects/stringlib/count.h @@ -4,6 +4,11 @@ #error must include "stringlib/fastsearch.h" before including this module #endif +// gh-97982: Implementing asciilib_count() is not worth it, FASTSEARCH() does +// not specialize the code for ASCII strings. Use ucs1lib_count() for ASCII and +// UCS1 strings: it's the same than asciilib_count(). +#if !STRINGLIB_IS_UNICODE || STRINGLIB_MAX_CHAR > 0x7Fu + Py_LOCAL_INLINE(Py_ssize_t) STRINGLIB(count)(const STRINGLIB_CHAR* str, Py_ssize_t str_len, const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, @@ -24,4 +29,4 @@ STRINGLIB(count)(const STRINGLIB_CHAR* str, Py_ssize_t str_len, return count; } - +#endif |