Antoine Pitrou | eeb7eea | 2011-10-06 18:57:27 +0200 | [diff] [blame] | 1 | #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 |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
Kristján Valur Jónsson | b81e538 | 2012-03-22 23:10:37 +0000 | [diff] [blame] | 19 | #undef small /* defined by some Windows headers */ |
| 20 | |
Antoine Pitrou | eeb7eea | 2011-10-06 18:57:27 +0200 | [diff] [blame] | 21 | typedef struct { |
| 22 | PyObject *large; /* A list of previously accumulated large strings */ |
| 23 | PyObject *small; /* Pending small strings */ |
| 24 | } _PyAccu; |
| 25 | |
| 26 | PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); |
| 27 | PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); |
| 28 | PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); |
| 29 | PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); |
| 30 | PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | } |
| 34 | #endif |
| 35 | |
| 36 | #endif /* Py_ACCU_H */ |
| 37 | #endif /* Py_LIMITED_API */ |