summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-12-01 08:56:42 (GMT)
committerGitHub <noreply@github.com>2020-12-01 08:56:42 (GMT)
commit00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0 (patch)
tree26ebb0fe409768193bb85be90c0229a0f44d6f8e /Python/marshal.c
parentb2d0c66e881301ed8908da3cb41bbf253c449b0c (diff)
downloadcpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.zip
cpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.tar.gz
cpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.tar.bz2
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().
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index d292987..fa4ec9e 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -638,7 +638,7 @@ r_string(Py_ssize_t n, RFILE *p)
return res;
}
if (p->buf == NULL) {
- p->buf = PyMem_MALLOC(n);
+ p->buf = PyMem_Malloc(n);
if (p->buf == NULL) {
PyErr_NoMemory();
return NULL;
@@ -646,7 +646,7 @@ r_string(Py_ssize_t n, RFILE *p)
p->buf_size = n;
}
else if (p->buf_size < n) {
- char *tmp = PyMem_REALLOC(p->buf, n);
+ char *tmp = PyMem_Realloc(p->buf, n);
if (tmp == NULL) {
PyErr_NoMemory();
return NULL;
@@ -1453,7 +1453,7 @@ PyMarshal_ReadShortFromFile(FILE *fp)
rf.buf = NULL;
res = r_short(&rf);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return res;
}
@@ -1468,7 +1468,7 @@ PyMarshal_ReadLongFromFile(FILE *fp)
rf.buf = NULL;
res = r_long(&rf);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return res;
}
@@ -1501,11 +1501,11 @@ PyMarshal_ReadLastObjectFromFile(FILE *fp)
off_t filesize;
filesize = getfilesize(fp);
if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) {
- char* pBuf = (char *)PyMem_MALLOC(filesize);
+ char* pBuf = (char *)PyMem_Malloc(filesize);
if (pBuf != NULL) {
size_t n = fread(pBuf, 1, (size_t)filesize, fp);
PyObject* v = PyMarshal_ReadObjectFromString(pBuf, n);
- PyMem_FREE(pBuf);
+ PyMem_Free(pBuf);
return v;
}
@@ -1534,7 +1534,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
result = r_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return result;
}
@@ -1555,7 +1555,7 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
result = r_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return result;
}
@@ -1684,7 +1684,7 @@ marshal_load(PyObject *module, PyObject *file)
result = read_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
} else
result = NULL;
}