mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-46848: Move _PyBytes_Find() to internal C API (GH-31642)
Move _PyBytes_Find() and _PyBytes_ReverseFind() functions to the internal C API. bytesobject.c now includes pycore_bytesobject.h.
This commit is contained in:
parent
03642df1a1
commit
b6b711a1aa
4 changed files with 21 additions and 19 deletions
|
@ -14,6 +14,25 @@ extern "C" {
|
|||
extern PyStatus _PyBytes_InitTypes(PyInterpreterState *);
|
||||
|
||||
|
||||
/* Substring Search.
|
||||
|
||||
Returns the index of the first occurence of
|
||||
a substring ("needle") in a larger text ("haystack").
|
||||
If the needle is not found, return -1.
|
||||
If the needle is found, add offset to the index.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(Py_ssize_t)
|
||||
_PyBytes_Find(const char *haystack, Py_ssize_t len_haystack,
|
||||
const char *needle, Py_ssize_t len_needle,
|
||||
Py_ssize_t offset);
|
||||
|
||||
/* Same as above, but search right-to-left */
|
||||
PyAPI_FUNC(Py_ssize_t)
|
||||
_PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack,
|
||||
const char *needle, Py_ssize_t len_needle,
|
||||
Py_ssize_t offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue