diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-08-02 21:05:01 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-08-02 21:05:01 (GMT) |
commit | b3f5501250b54de24846480658ca473a5393db49 (patch) | |
tree | 599b03a679fcb27457d67940279487ed20518c8b /Objects/stringlib | |
parent | 77821b68a7f23318374087e9c6710ef66312f78d (diff) | |
download | cpython-b3f5501250b54de24846480658ca473a5393db49.zip cpython-b3f5501250b54de24846480658ca473a5393db49.tar.gz cpython-b3f5501250b54de24846480658ca473a5393db49.tar.bz2 |
Close #15534: Fix a typo in the fast search function of the string library (_s => s)
Replace _s with ptr to avoid future confusion. Add also non regression tests.
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/fastsearch.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h index f3e0461..5b8d5db 100644 --- a/Objects/stringlib/fastsearch.h +++ b/Objects/stringlib/fastsearch.h @@ -48,16 +48,16 @@ STRINGLIB(fastsearch_memchr_1char)(const STRINGLIB_CHAR* s, Py_ssize_t n, } while (0) if (mode == FAST_SEARCH) { - const STRINGLIB_CHAR *_s = s; + const STRINGLIB_CHAR *ptr = s; const STRINGLIB_CHAR *e = s + n; - while (_s < e) { - DO_MEMCHR(memchr, _s, needle, e - _s); + while (ptr < e) { + DO_MEMCHR(memchr, ptr, needle, e - ptr); if (found == NULL) return -1; if (sizeof(STRINGLIB_CHAR) == 1 || *found == ch) - return (found - _s); + return (found - s); /* False positive */ - _s = found + 1; + ptr = found + 1; } return -1; } |