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:
Antoine Pitrou 2010-01-02 21:12:58 +00:00
parent d3e323215c
commit 5b7139aab4
11 changed files with 148 additions and 149 deletions

View file

@ -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 */