Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:20:57

0001 #ifndef Py_INTERNAL_BYTESOBJECT_H
0002 #define Py_INTERNAL_BYTESOBJECT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 #ifndef Py_BUILD_CORE
0008 #  error "this header requires Py_BUILD_CORE define"
0009 #endif
0010 
0011 
0012 /* Substring Search.
0013 
0014    Returns the index of the first occurrence of
0015    a substring ("needle") in a larger text ("haystack").
0016    If the needle is not found, return -1.
0017    If the needle is found, add offset to the index.
0018 */
0019 
0020 PyAPI_FUNC(Py_ssize_t)
0021 _PyBytes_Find(const char *haystack, Py_ssize_t len_haystack,
0022               const char *needle, Py_ssize_t len_needle,
0023               Py_ssize_t offset);
0024 
0025 /* Same as above, but search right-to-left */
0026 PyAPI_FUNC(Py_ssize_t)
0027 _PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack,
0028                      const char *needle, Py_ssize_t len_needle,
0029                      Py_ssize_t offset);
0030 
0031 
0032 /** Helper function to implement the repeat and inplace repeat methods on a buffer
0033  *
0034  * len_dest is assumed to be an integer multiple of len_src.
0035  * If src equals dest, then assume the operation is inplace.
0036  *
0037  * This method repeately doubles the number of bytes copied to reduce
0038  * the number of invocations of memcpy.
0039  */
0040 PyAPI_FUNC(void)
0041 _PyBytes_Repeat(char* dest, Py_ssize_t len_dest,
0042     const char* src, Py_ssize_t len_src);
0043 
0044 #ifdef __cplusplus
0045 }
0046 #endif
0047 #endif /* !Py_INTERNAL_BYTESOBJECT_H */