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 /Modules | |
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 'Modules')
-rw-r--r-- | Modules/arraymodule.c | 4 | ||||
-rw-r--r-- | Modules/hashtable.c | 6 | ||||
-rw-r--r-- | Modules/hashtable.h | 8 | ||||
-rw-r--r-- | Modules/zlibmodule.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 5868c52..2caa8ee 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -836,10 +836,10 @@ array_repeat(arrayobject *a, Py_ssize_t n) memset(np->ob_item, a->ob_item[0], newbytes); } else { Py_ssize_t done = oldbytes; - Py_MEMCPY(np->ob_item, a->ob_item, oldbytes); + memcpy(np->ob_item, a->ob_item, oldbytes); while (done < newbytes) { Py_ssize_t ncopy = (done <= newbytes-done) ? done : newbytes-done; - Py_MEMCPY(np->ob_item+done, np->ob_item, ncopy); + memcpy(np->ob_item+done, np->ob_item, ncopy); done += ncopy; } } diff --git a/Modules/hashtable.c b/Modules/hashtable.c index 3462fef..0547a6d 100644 --- a/Modules/hashtable.c +++ b/Modules/hashtable.c @@ -64,14 +64,14 @@ #define ENTRY_READ_PDATA(TABLE, ENTRY, DATA_SIZE, PDATA) \ do { \ assert((DATA_SIZE) == (TABLE)->data_size); \ - Py_MEMCPY((PDATA), _Py_HASHTABLE_ENTRY_PDATA(TABLE, (ENTRY)), \ + memcpy((PDATA), _Py_HASHTABLE_ENTRY_PDATA(TABLE, (ENTRY)), \ (DATA_SIZE)); \ } while (0) #define ENTRY_WRITE_PDATA(TABLE, ENTRY, DATA_SIZE, PDATA) \ do { \ assert((DATA_SIZE) == (TABLE)->data_size); \ - Py_MEMCPY((void *)_Py_HASHTABLE_ENTRY_PDATA((TABLE), (ENTRY)), \ + memcpy((void *)_Py_HASHTABLE_ENTRY_PDATA((TABLE), (ENTRY)), \ (PDATA), (DATA_SIZE)); \ } while (0) @@ -337,7 +337,7 @@ _Py_hashtable_set(_Py_hashtable_t *ht, size_t key_size, const void *pkey, } entry->key_hash = key_hash; - Py_MEMCPY((void *)_Py_HASHTABLE_ENTRY_PKEY(entry), pkey, ht->key_size); + memcpy((void *)_Py_HASHTABLE_ENTRY_PKEY(entry), pkey, ht->key_size); if (data) ENTRY_WRITE_PDATA(ht, entry, data_size, data); diff --git a/Modules/hashtable.h b/Modules/hashtable.h index 18fed09..dbec23d 100644 --- a/Modules/hashtable.h +++ b/Modules/hashtable.h @@ -43,26 +43,26 @@ typedef struct { #define _Py_HASHTABLE_READ_KEY(TABLE, PKEY, DST_KEY) \ do { \ assert(sizeof(DST_KEY) == (TABLE)->key_size); \ - Py_MEMCPY(&(DST_KEY), (PKEY), sizeof(DST_KEY)); \ + memcpy(&(DST_KEY), (PKEY), sizeof(DST_KEY)); \ } while (0) #define _Py_HASHTABLE_ENTRY_READ_KEY(TABLE, ENTRY, KEY) \ do { \ assert(sizeof(KEY) == (TABLE)->key_size); \ - Py_MEMCPY(&(KEY), _Py_HASHTABLE_ENTRY_PKEY(ENTRY), sizeof(KEY)); \ + memcpy(&(KEY), _Py_HASHTABLE_ENTRY_PKEY(ENTRY), sizeof(KEY)); \ } while (0) #define _Py_HASHTABLE_ENTRY_READ_DATA(TABLE, ENTRY, DATA) \ do { \ assert(sizeof(DATA) == (TABLE)->data_size); \ - Py_MEMCPY(&(DATA), _Py_HASHTABLE_ENTRY_PDATA(TABLE, (ENTRY)), \ + memcpy(&(DATA), _Py_HASHTABLE_ENTRY_PDATA(TABLE, (ENTRY)), \ sizeof(DATA)); \ } while (0) #define _Py_HASHTABLE_ENTRY_WRITE_DATA(TABLE, ENTRY, DATA) \ do { \ assert(sizeof(DATA) == (TABLE)->data_size); \ - Py_MEMCPY((void *)_Py_HASHTABLE_ENTRY_PDATA((TABLE), (ENTRY)), \ + memcpy((void *)_Py_HASHTABLE_ENTRY_PDATA((TABLE), (ENTRY)), \ &(DATA), sizeof(DATA)); \ } while (0) diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 4cded31..cfe7f88 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -721,9 +721,9 @@ save_unconsumed_input(compobject *self, Py_buffer *data, int err) new_data = PyBytes_FromStringAndSize(NULL, new_size); if (new_data == NULL) return -1; - Py_MEMCPY(PyBytes_AS_STRING(new_data), + memcpy(PyBytes_AS_STRING(new_data), PyBytes_AS_STRING(self->unused_data), old_size); - Py_MEMCPY(PyBytes_AS_STRING(new_data) + old_size, + memcpy(PyBytes_AS_STRING(new_data) + old_size, self->zst.next_in, left_size); Py_SETREF(self->unused_data, new_data); self->zst.avail_in = 0; |