diff options
| author | Victor Stinner <vstinner@python.org> | 2022-10-11 17:59:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-11 17:59:58 +0200 |
| commit | df3a6d9beb8a7a3fe87a6d4126384fd3e0213853 (patch) | |
| tree | ddc5781df401521d304639fb41e4530f48f8a8b7 /Objects/stringlib | |
| parent | 7ec2e279fea3b340f642cff888bfa45368f5ded0 (diff) | |
| download | cpython-git-df3a6d9beb8a7a3fe87a6d4126384fd3e0213853.tar.gz | |
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 f48500bf56..e20edcd104 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 |
