@@ -47,83 +47,3 @@ static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
47
47
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
48
48
x must be an iterable object. */
49
49
PyAPI_FUNC (PyObject * ) _PyBytes_Join (PyObject * sep , PyObject * x );
50
-
51
-
52
- /* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
53
- A _PyBytesWriter variable must be declared at the end of variables in a
54
- function to optimize the memory allocation on the stack. */
55
- typedef struct {
56
- /* bytes, bytearray or NULL (when the small buffer is used) */
57
- PyObject * buffer ;
58
-
59
- /* Number of allocated size. */
60
- Py_ssize_t allocated ;
61
-
62
- /* Minimum number of allocated bytes,
63
- incremented by _PyBytesWriter_Prepare() */
64
- Py_ssize_t min_size ;
65
-
66
- /* If non-zero, use a bytearray instead of a bytes object for buffer. */
67
- int use_bytearray ;
68
-
69
- /* If non-zero, overallocate the buffer (default: 0).
70
- This flag must be zero if use_bytearray is non-zero. */
71
- int overallocate ;
72
-
73
- /* Stack buffer */
74
- int use_small_buffer ;
75
- char small_buffer [512 ];
76
- } _PyBytesWriter ;
77
-
78
- /* Initialize a bytes writer
79
-
80
- By default, the overallocation is disabled. Set the overallocate attribute
81
- to control the allocation of the buffer. */
82
- PyAPI_FUNC (void ) _PyBytesWriter_Init (_PyBytesWriter * writer );
83
-
84
- /* Get the buffer content and reset the writer.
85
- Return a bytes object, or a bytearray object if use_bytearray is non-zero.
86
- Raise an exception and return NULL on error. */
87
- PyAPI_FUNC (PyObject * ) _PyBytesWriter_Finish (_PyBytesWriter * writer ,
88
- void * str );
89
-
90
- /* Deallocate memory of a writer (clear its internal buffer). */
91
- PyAPI_FUNC (void ) _PyBytesWriter_Dealloc (_PyBytesWriter * writer );
92
-
93
- /* Allocate the buffer to write size bytes.
94
- Return the pointer to the beginning of buffer data.
95
- Raise an exception and return NULL on error. */
96
- PyAPI_FUNC (void * ) _PyBytesWriter_Alloc (_PyBytesWriter * writer ,
97
- Py_ssize_t size );
98
-
99
- /* Ensure that the buffer is large enough to write *size* bytes.
100
- Add size to the writer minimum size (min_size attribute).
101
-
102
- str is the current pointer inside the buffer.
103
- Return the updated current pointer inside the buffer.
104
- Raise an exception and return NULL on error. */
105
- PyAPI_FUNC (void * ) _PyBytesWriter_Prepare (_PyBytesWriter * writer ,
106
- void * str ,
107
- Py_ssize_t size );
108
-
109
- /* Resize the buffer to make it larger.
110
- The new buffer may be larger than size bytes because of overallocation.
111
- Return the updated current pointer inside the buffer.
112
- Raise an exception and return NULL on error.
113
-
114
- Note: size must be greater than the number of allocated bytes in the writer.
115
-
116
- This function doesn't use the writer minimum size (min_size attribute).
117
-
118
- See also _PyBytesWriter_Prepare().
119
- */
120
- PyAPI_FUNC (void * ) _PyBytesWriter_Resize (_PyBytesWriter * writer ,
121
- void * str ,
122
- Py_ssize_t size );
123
-
124
- /* Write bytes.
125
- Raise an exception and return NULL on error. */
126
- PyAPI_FUNC (void * ) _PyBytesWriter_WriteBytes (_PyBytesWriter * writer ,
127
- void * str ,
128
- const void * bytes ,
129
- Py_ssize_t size );
0 commit comments