blob: 9655d37bb1f73bc81586dbf960f25c170e0144ac [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
19typedef struct {
20 PyObject *large; /* A list of previously accumulated large strings */
21 PyObject *small; /* Pending small strings */
22} _PyAccu;
23
24PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc);
25PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode);
26PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc);
27PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc);
28PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc);
29
30#ifdef __cplusplus
31}
32#endif
33
34#endif /* Py_ACCU_H */
35#endif /* Py_LIMITED_API */