needforspeed: stringlib refactoring: use stringlib/find for string find

This commit is contained in:
Fredrik Lundh 2006-05-26 19:48:07 +00:00
parent cc7570fd90
commit e6e43c867d
3 changed files with 26 additions and 31 deletions

View file

@ -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;