mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Add _PyBytesWriter_WriteBytes() to factorize the code
This commit is contained in:
parent
ad7715891e
commit
ce179bf6ba
4 changed files with 35 additions and 16 deletions
|
@ -3995,3 +3995,17 @@ _PyBytesWriter_Finish(_PyBytesWriter *writer, char *str)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
char*
|
||||
_PyBytesWriter_WriteBytes(_PyBytesWriter *writer, char *str,
|
||||
char *bytes, Py_ssize_t size)
|
||||
{
|
||||
str = _PyBytesWriter_Prepare(writer, str, size);
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
Py_MEMCPY(str, bytes, size);
|
||||
str += size;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue