blob: 3636ea6c98fd6263111d457352ad9af228c5420d [file] [log] [blame]
Antoine Pitroueeb7eea2011-10-06 18:57:27 +02001#ifndef Py_LIMITED_API
2#ifndef Py_ACCU_H
3#define Py_ACCU_H
4
5/*** This is a private API for use by the interpreter and the stdlib.
6 *** Its definition may be changed or removed at any moment.
7 ***/
8
9/*
10 * A two-level accumulator of unicode objects that avoids both the overhead
11 * of keeping a huge number of small separate objects, and the quadratic
12 * behaviour of using a naive repeated concatenation scheme.
13 */
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
Kristján Valur Jónssonb81e5382012-03-22 23:10:37 +000019#undef small /* defined by some Windows headers */
20
Antoine Pitroueeb7eea2011-10-06 18:57:27 +020021typedef struct {
22 PyObject *large; /* A list of previously accumulated large strings */
23 PyObject *small; /* Pending small strings */
24} _PyAccu;
25
26PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc);
27PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode);
28PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc);
29PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc);
30PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc);
31
32#ifdef __cplusplus
33}
34#endif
35
36#endif /* Py_ACCU_H */
37#endif /* Py_LIMITED_API */