mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)
No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
This commit is contained in:
parent
b2d0c66e88
commit
00d7abd7ef
33 changed files with 175 additions and 188 deletions
|
@ -567,14 +567,14 @@ _odict_resize(PyODictObject *od)
|
|||
i = _odict_get_index_raw(od, _odictnode_KEY(node),
|
||||
_odictnode_HASH(node));
|
||||
if (i < 0) {
|
||||
PyMem_FREE(fast_nodes);
|
||||
PyMem_Free(fast_nodes);
|
||||
return -1;
|
||||
}
|
||||
fast_nodes[i] = node;
|
||||
}
|
||||
|
||||
/* Replace the old fast nodes table. */
|
||||
PyMem_FREE(od->od_fast_nodes);
|
||||
PyMem_Free(od->od_fast_nodes);
|
||||
od->od_fast_nodes = fast_nodes;
|
||||
od->od_fast_nodes_size = size;
|
||||
od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys;
|
||||
|
@ -683,7 +683,7 @@ _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
|||
}
|
||||
|
||||
/* must not be added yet */
|
||||
node = (_ODictNode *)PyMem_MALLOC(sizeof(_ODictNode));
|
||||
node = (_ODictNode *)PyMem_Malloc(sizeof(_ODictNode));
|
||||
if (node == NULL) {
|
||||
Py_DECREF(key);
|
||||
PyErr_NoMemory();
|
||||
|
@ -701,7 +701,7 @@ _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
|||
#define _odictnode_DEALLOC(node) \
|
||||
do { \
|
||||
Py_DECREF(_odictnode_KEY(node)); \
|
||||
PyMem_FREE((void *)node); \
|
||||
PyMem_Free((void *)node); \
|
||||
} while (0)
|
||||
|
||||
/* Repeated calls on the same node are no-ops. */
|
||||
|
@ -776,7 +776,7 @@ _odict_clear_nodes(PyODictObject *od)
|
|||
{
|
||||
_ODictNode *node, *next;
|
||||
|
||||
PyMem_FREE(od->od_fast_nodes);
|
||||
PyMem_Free(od->od_fast_nodes);
|
||||
od->od_fast_nodes = NULL;
|
||||
od->od_fast_nodes_size = 0;
|
||||
od->od_resize_sentinel = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue