Skip to content

Commit 07ae0d6

Browse files
committed
Make _PyBytesWriter_Resize() static
1 parent 7a53e80 commit 07ae0d6

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
@@ -120,21 +120,6 @@ PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
120120
void *str,
121121
Py_ssize_t size);
122122

123-
/* Resize the buffer to make it larger.
124-
The new buffer may be larger than size bytes because of overallocation.
125-
Return the updated current pointer inside the buffer.
126-
Raise an exception and return NULL on error.
127-
128-
Note: size must be greater than the number of allocated bytes in the writer.
129-
130-
This function doesn't use the writer minimum size (min_size attribute).
131-
132-
See also _PyBytesWriter_Prepare().
133-
*/
134-
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
135-
void *str,
136-
Py_ssize_t size);
137-
138123
/* Write bytes.
139124
Raise an exception and return NULL on error. */
140125
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)