commit | ce179bf6baed91ba84cc3ff647e96287c3b8e2f2 | [log] [tgz] |
---|---|---|
author | Victor Stinner <victor.stinner@gmail.com> | Fri Oct 09 12:57:22 2015 +0200 |
committer | Victor Stinner <victor.stinner@gmail.com> | Fri Oct 09 12:57:22 2015 +0200 |
tree | 47ccc59059e1b2565784bbaf8c9c778a39628cfa | |
parent | ad7715891e3c6c51b4860e0d496843ee5417206b [diff] [blame] |
Add _PyBytesWriter_WriteBytes() to factorize the code
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 075edf8..3aa905c 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c
@@ -3995,3 +3995,17 @@ 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; +}