Path: blob/main/Include/internal/pycore_bytesobject.h
12 views
#ifndef Py_INTERNAL_BYTESOBJECT_H1#define Py_INTERNAL_BYTESOBJECT_H2#ifdef __cplusplus3extern "C" {4#endif56#ifndef Py_BUILD_CORE7# error "this header requires Py_BUILD_CORE define"8#endif91011/* Substring Search.1213Returns the index of the first occurrence of14a substring ("needle") in a larger text ("haystack").15If the needle is not found, return -1.16If the needle is found, add offset to the index.17*/1819PyAPI_FUNC(Py_ssize_t)20_PyBytes_Find(const char *haystack, Py_ssize_t len_haystack,21const char *needle, Py_ssize_t len_needle,22Py_ssize_t offset);2324/* Same as above, but search right-to-left */25PyAPI_FUNC(Py_ssize_t)26_PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack,27const char *needle, Py_ssize_t len_needle,28Py_ssize_t offset);293031/** Helper function to implement the repeat and inplace repeat methods on a buffer32*33* len_dest is assumed to be an integer multiple of len_src.34* If src equals dest, then assume the operation is inplace.35*36* This method repeately doubles the number of bytes copied to reduce37* the number of invocations of memcpy.38*/39PyAPI_FUNC(void)40_PyBytes_Repeat(char* dest, Py_ssize_t len_dest,41const char* src, Py_ssize_t len_src);4243#ifdef __cplusplus44}45#endif46#endif /* !Py_INTERNAL_BYTESOBJECT_H */474849