Skip to content

Commit e7830f3

Browse files
committed
Make _PyBytesWriter_Resize() static
1 parent a471040 commit e7830f3

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

Include/internal/pycore_bytesobject.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,6 @@ PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
124124
void *str,
125125
Py_ssize_t size);
126126

127-
/* Resize the buffer to make it larger.
128-
The new buffer may be larger than size bytes because of overallocation.
129-
Return the updated current pointer inside the buffer.
130-
Raise an exception and return NULL on error.
131-
132-
Note: size must be greater than the number of allocated bytes in the writer.
133-
134-
This function doesn't use the writer minimum size (min_size attribute).
135-
136-
See also _PyBytesWriter_Prepare().
137-
*/
138-
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
139-
void *str,
140-
Py_ssize_t size);
141-
142127
/* Write bytes.
143128
Raise an exception and return NULL on error. */
144129
PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,

Objects/bytesobject.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class bytes "PyBytesObject *" "&PyBytes_Type"
3434
/* Forward declaration */
3535
Py_LOCAL_INLINE(Py_ssize_t) _PyBytesWriter_GetSize(_PyBytesWriter *writer,
3636
char *str);
37+
static void* _PyBytesWriter_Resize(_PyBytesWriter *writer,
38+
void *str, Py_ssize_t size);
3739

3840

3941
#define CHARACTERS _Py_SINGLETON(bytes_characters)
@@ -3505,7 +3507,18 @@ PyBytesWriter_CheckPtr(PyBytesWriter *pub_writer, char *str)
35053507
}
35063508

35073509

3508-
void*
3510+
/* Resize the buffer to make it larger.
3511+
The new buffer may be larger than size bytes because of overallocation.
3512+
Return the updated current pointer inside the buffer.
3513+
Raise an exception and return NULL on error.
3514+
3515+
Note: size must be greater than the number of allocated bytes in the writer.
3516+
3517+
This function doesn't use the writer minimum size (min_size attribute).
3518+
3519+
See also _PyBytesWriter_Prepare().
3520+
*/
3521+
static void*
35093522
_PyBytesWriter_Resize(_PyBytesWriter *writer, void *str, Py_ssize_t size)
35103523
{
35113524
assert(_PyBytesWriter_CheckConsistency(writer, str));

0 commit comments

Comments
 (0)