diff options
author | Christian Heimes <christian@python.org> | 2016-09-13 18:22:02 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-13 18:22:02 (GMT) |
commit | f051e43b22af014364e231c36489e6745993ea34 (patch) | |
tree | 7a35470d92a6a5146bfa321bda6f9024e90adc7d /Objects/stringlib | |
parent | a4d9b17b1fd0f3432c72d686c7668169e39e7119 (diff) | |
download | cpython-f051e43b22af014364e231c36489e6745993ea34.zip cpython-f051e43b22af014364e231c36489e6745993ea34.tar.gz cpython-f051e43b22af014364e231c36489e6745993ea34.tar.bz2 |
Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize memcpy().
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/join.h | 6 | ||||
-rw-r--r-- | Objects/stringlib/transmogrify.h | 40 |
2 files changed, 23 insertions, 23 deletions
diff --git a/Objects/stringlib/join.h b/Objects/stringlib/join.h index 90f966d..6f314e1 100644 --- a/Objects/stringlib/join.h +++ b/Objects/stringlib/join.h @@ -107,7 +107,7 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) for (i = 0; i < nbufs; i++) { Py_ssize_t n = buffers[i].len; char *q = buffers[i].buf; - Py_MEMCPY(p, q, n); + memcpy(p, q, n); p += n; } goto done; @@ -116,12 +116,12 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) Py_ssize_t n; char *q; if (i) { - Py_MEMCPY(p, sepstr, seplen); + memcpy(p, sepstr, seplen); p += seplen; } n = buffers[i].len; q = buffers[i].buf; - Py_MEMCPY(p, q, n); + memcpy(p, q, n); p += n; } goto done; diff --git a/Objects/stringlib/transmogrify.h b/Objects/stringlib/transmogrify.h index 9903912..a314572 100644 --- a/Objects/stringlib/transmogrify.h +++ b/Objects/stringlib/transmogrify.h @@ -108,7 +108,7 @@ pad(PyObject *self, Py_ssize_t left, Py_ssize_t right, char fill) if (u) { if (left) memset(STRINGLIB_STR(u), fill, left); - Py_MEMCPY(STRINGLIB_STR(u) + left, + memcpy(STRINGLIB_STR(u) + left, STRINGLIB_STR(self), STRINGLIB_LEN(self)); if (right) @@ -275,13 +275,13 @@ stringlib_replace_interleave(PyObject *self, if (to_len > 1) { /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; count -= 1; for (i = 0; i < count; i++) { *result_s++ = *self_s++; - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; } } @@ -297,7 +297,7 @@ stringlib_replace_interleave(PyObject *self, } /* Copy the rest of the original string */ - Py_MEMCPY(result_s, self_s, self_len - i); + memcpy(result_s, self_s, self_len - i); return result; } @@ -337,11 +337,11 @@ stringlib_replace_delete_single_character(PyObject *self, next = findchar(start, end - start, from_c); if (next == NULL) break; - Py_MEMCPY(result_s, start, next - start); + memcpy(result_s, start, next - start); result_s += (next - start); start = next + 1; } - Py_MEMCPY(result_s, start, end - start); + memcpy(result_s, start, end - start); return result; } @@ -390,12 +390,12 @@ stringlib_replace_delete_substring(PyObject *self, break; next = start + offset; - Py_MEMCPY(result_s, start, next - start); + memcpy(result_s, start, next - start); result_s += (next - start); start = next + from_len; } - Py_MEMCPY(result_s, start, end - start); + memcpy(result_s, start, end - start); return result; } @@ -427,7 +427,7 @@ stringlib_replace_single_character_in_place(PyObject *self, return NULL; } result_s = STRINGLIB_STR(result); - Py_MEMCPY(result_s, self_s, self_len); + memcpy(result_s, self_s, self_len); /* change everything in-place, starting with this one */ start = result_s + (next - self_s); @@ -477,11 +477,11 @@ stringlib_replace_substring_in_place(PyObject *self, return NULL; } result_s = STRINGLIB_STR(result); - Py_MEMCPY(result_s, self_s, self_len); + memcpy(result_s, self_s, self_len); /* change everything in-place, starting with this one */ start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); + memcpy(start, to_s, from_len); start += from_len; end = result_s + self_len; @@ -491,7 +491,7 @@ stringlib_replace_substring_in_place(PyObject *self, 0); if (offset == -1) break; - Py_MEMCPY(start + offset, to_s, from_len); + memcpy(start + offset, to_s, from_len); start += offset + from_len; } @@ -544,20 +544,20 @@ stringlib_replace_single_character(PyObject *self, if (next == start) { /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; start += 1; } else { /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next - start); + memcpy(result_s, start, next - start); result_s += (next - start); - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; start = next + 1; } } /* Copy the remainder of the remaining bytes */ - Py_MEMCPY(result_s, start, end - start); + memcpy(result_s, start, end - start); return result; } @@ -613,20 +613,20 @@ stringlib_replace_substring(PyObject *self, next = start + offset; if (next == start) { /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; start += from_len; } else { /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next - start); + memcpy(result_s, start, next - start); result_s += (next - start); - Py_MEMCPY(result_s, to_s, to_len); + memcpy(result_s, to_s, to_len); result_s += to_len; start = next + from_len; } } /* Copy the remainder of the remaining bytes */ - Py_MEMCPY(result_s, start, end - start); + memcpy(result_s, start, end - start); return result; } |