mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Issue #7462: Implement the stringlib fast search algorithm for the rfind
,
`rindex`, `rsplit` and `rpartition` methods. Patch by Florent Xicluna.
This commit is contained in:
parent
d3e323215c
commit
5b7139aab4
11 changed files with 148 additions and 149 deletions
|
@ -31,23 +31,4 @@
|
|||
|
||||
#define STRINGLIB_WANT_CONTAINS_OBJ 1
|
||||
|
||||
/* STRINGLIB_CMP was defined as:
|
||||
|
||||
Py_LOCAL_INLINE(int)
|
||||
STRINGLIB_CMP(const Py_UNICODE* str, const Py_UNICODE* other, Py_ssize_t len)
|
||||
{
|
||||
if (str[0] != other[0])
|
||||
return 1;
|
||||
return memcmp((void*) str, (void*) other, len * sizeof(Py_UNICODE));
|
||||
}
|
||||
|
||||
but unfortunately that gives a error if the function isn't used in a file that
|
||||
includes this file. So, reluctantly convert it to a macro instead. */
|
||||
|
||||
#define STRINGLIB_CMP(str, other, len) \
|
||||
(((str)[0] != (other)[0]) ? \
|
||||
1 : \
|
||||
memcmp((void*) (str), (void*) (other), (len) * sizeof(Py_UNICODE)))
|
||||
|
||||
|
||||
#endif /* !STRINGLIB_UNICODEDEFS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue