summaryrefslogtreecommitdiff
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2016-09-13 20:22:02 +0200
committerChristian Heimes <christian@python.org>2016-09-13 20:22:02 +0200
commitf051e43b22af014364e231c36489e6745993ea34 (patch)
tree7a35470d92a6a5146bfa321bda6f9024e90adc7d /Objects/bytesobject.c
parenta4d9b17b1fd0f3432c72d686c7668169e39e7119 (diff)
downloadcpython-git-f051e43b22af014364e231c36489e6745993ea34.tar.gz
Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize memcpy().
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 4d14451254..1550083e34 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -120,7 +120,7 @@ PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
if (str == NULL)
return (PyObject *) op;
- Py_MEMCPY(op->ob_sval, str, size);
+ memcpy(op->ob_sval, str, size);
/* share short strings */
if (size == 1) {
characters[*str & UCHAR_MAX] = op;
@@ -163,7 +163,7 @@ PyBytes_FromString(const char *str)
return PyErr_NoMemory();
(void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
op->ob_shash = -1;
- Py_MEMCPY(op->ob_sval, str, size+1);
+ memcpy(op->ob_sval, str, size+1);
/* share short strings */
if (size == 0) {
nullstring = op;
@@ -437,7 +437,7 @@ formatfloat(PyObject *v, int flags, int prec, int type,
str = _PyBytesWriter_Prepare(writer, str, len);
if (str == NULL)
return NULL;
- Py_MEMCPY(str, p, len);
+ memcpy(str, p, len);
PyMem_Free(p);
str += len;
return str;
@@ -626,7 +626,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
len = format_len - (fmt - format);
assert(len != 0);
- Py_MEMCPY(res, fmt, len);
+ memcpy(res, fmt, len);
res += len;
fmt += len;
fmtcnt -= (len - 1);
@@ -1009,7 +1009,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
}
/* Copy bytes */
- Py_MEMCPY(res, pbuf, len);
+ memcpy(res, pbuf, len);
res += len;
/* Pad right with the fill character if needed */
@@ -1473,12 +1473,12 @@ bytes_repeat(PyBytesObject *a, Py_ssize_t n)
}
i = 0;
if (i < size) {
- Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a));
+ memcpy(op->ob_sval, a->ob_sval, Py_SIZE(a));
i = Py_SIZE(a);
}
while (i < size) {
j = (i <= size-i) ? i : size-i;
- Py_MEMCPY(op->ob_sval+i, op->ob_sval, j);
+ memcpy(op->ob_sval+i, op->ob_sval, j);
i += j;
}
return (PyObject *) op;
@@ -2765,7 +2765,7 @@ bytes_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
n = PyBytes_GET_SIZE(tmp);
pnew = type->tp_alloc(type, n);
if (pnew != NULL) {
- Py_MEMCPY(PyBytes_AS_STRING(pnew),
+ memcpy(PyBytes_AS_STRING(pnew),
PyBytes_AS_STRING(tmp), n+1);
((PyBytesObject *)pnew)->ob_shash =
((PyBytesObject *)tmp)->ob_shash;
@@ -3237,7 +3237,7 @@ _PyBytesWriter_Resize(_PyBytesWriter *writer, void *str, Py_ssize_t size)
dest = PyByteArray_AS_STRING(writer->buffer);
else
dest = PyBytes_AS_STRING(writer->buffer);
- Py_MEMCPY(dest,
+ memcpy(dest,
writer->small_buffer,
pos);
}
@@ -3372,7 +3372,7 @@ _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, void *ptr,
if (str == NULL)
return NULL;
- Py_MEMCPY(str, bytes, size);
+ memcpy(str, bytes, size);
str += size;
return str;