(root)/
Python-3.11.7/
Include/
internal/
pycore_bytesobject.h
       1  #ifndef Py_INTERNAL_BYTESOBJECT_H
       2  #define Py_INTERNAL_BYTESOBJECT_H
       3  #ifdef __cplusplus
       4  extern "C" {
       5  #endif
       6  
       7  #ifndef Py_BUILD_CORE
       8  #  error "this header requires Py_BUILD_CORE define"
       9  #endif
      10  
      11  
      12  /* runtime lifecycle */
      13  
      14  extern PyStatus _PyBytes_InitTypes(PyInterpreterState *);
      15  
      16  
      17  /* Substring Search.
      18  
      19     Returns the index of the first occurrence of
      20     a substring ("needle") in a larger text ("haystack").
      21     If the needle is not found, return -1.
      22     If the needle is found, add offset to the index.
      23  */
      24  
      25  PyAPI_FUNC(Py_ssize_t)
      26  _PyBytes_Find(const char *haystack, Py_ssize_t len_haystack,
      27                const char *needle, Py_ssize_t len_needle,
      28                Py_ssize_t offset);
      29  
      30  /* Same as above, but search right-to-left */
      31  PyAPI_FUNC(Py_ssize_t)
      32  _PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack,
      33                       const char *needle, Py_ssize_t len_needle,
      34                       Py_ssize_t offset);
      35  
      36  
      37  /** Helper function to implement the repeat and inplace repeat methods on a buffer
      38   *
      39   * len_dest is assumed to be an integer multiple of len_src.
      40   * If src equals dest, then assume the operation is inplace.
      41   *
      42   * This method repeately doubles the number of bytes copied to reduce
      43   * the number of invocations of memcpy.
      44   */
      45  PyAPI_FUNC(void)
      46  _PyBytes_Repeat(char* dest, Py_ssize_t len_dest,
      47      const char* src, Py_ssize_t len_src);
      48  
      49  #ifdef __cplusplus
      50  }
      51  #endif
      52  #endif /* !Py_INTERNAL_BYTESOBJECT_H */