mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Use memcpy() instead of memmove() when the buffers are known to be distinct.
This commit is contained in:
parent
ef9bf4031a
commit
66d31f8f38
1 changed files with 2 additions and 2 deletions
|
@ -518,7 +518,7 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
|
|||
else
|
||||
p = recycle = NULL;
|
||||
if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */
|
||||
memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *));
|
||||
memcpy(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *));
|
||||
p += ihigh - ilow;
|
||||
if (d < 0) {
|
||||
memmove(&item[ihigh+d], &item[ihigh],
|
||||
|
@ -537,7 +537,7 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v)
|
|||
item = a->ob_item;
|
||||
memmove(&item[ihigh+d], &item[ihigh],
|
||||
(s - ihigh)*sizeof(PyObject *));
|
||||
memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *));
|
||||
memcpy(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *));
|
||||
p += ihigh - ilow;
|
||||
}
|
||||
for (k = 0; k < n; k++, ilow++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue