accu.h 1016 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef Py_LIMITED_API
  2. #ifndef Py_ACCU_H
  3. #define Py_ACCU_H
  4. /*** This is a private API for use by the interpreter and the stdlib.
  5. *** Its definition may be changed or removed at any moment.
  6. ***/
  7. /*
  8. * A two-level accumulator of unicode objects that avoids both the overhead
  9. * of keeping a huge number of small separate objects, and the quadratic
  10. * behaviour of using a naive repeated concatenation scheme.
  11. */
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #undef small /* defined by some Windows headers */
  16. typedef struct {
  17. PyObject *large; /* A list of previously accumulated large strings */
  18. PyObject *small; /* Pending small strings */
  19. } _PyAccu;
  20. PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc);
  21. PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode);
  22. PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc);
  23. PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc);
  24. PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc);
  25. #ifdef __cplusplus
  26. }
  27. #endif
  28. #endif /* Py_ACCU_H */
  29. #endif /* Py_LIMITED_API */