mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
needforspeed: stringlib refactoring: use stringlib/find for string find
This commit is contained in:
parent
cc7570fd90
commit
e6e43c867d
3 changed files with 26 additions and 31 deletions
|
@ -3967,16 +3967,15 @@ Py_ssize_t PyUnicode_Find(PyObject *str,
|
|||
|
||||
if (direction > 0)
|
||||
result = stringlib_find(
|
||||
str_obj->str + start, end - start, sub_obj->str, sub_obj->length
|
||||
str_obj->str + start, end - start, sub_obj->str, sub_obj->length,
|
||||
start
|
||||
);
|
||||
else
|
||||
result = stringlib_rfind(
|
||||
str_obj->str + start, end - start, sub_obj->str, sub_obj->length
|
||||
str_obj->str + start, end - start, sub_obj->str, sub_obj->length,
|
||||
start
|
||||
);
|
||||
|
||||
if (result >= 0)
|
||||
result += start;
|
||||
|
||||
Py_DECREF(str_obj);
|
||||
Py_DECREF(sub_obj);
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue