summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_localemodule.c4
-rw-r--r--Modules/_pickle.c24
-rw-r--r--Modules/_sre.c8
-rw-r--r--Modules/_ssl.c6
-rw-r--r--Modules/_struct.c6
-rw-r--r--Modules/_testcapimodule.c4
-rw-r--r--Modules/_threadmodule.c6
-rw-r--r--Modules/_tkinter.c8
-rw-r--r--Modules/arraymodule.c4
-rw-r--r--Modules/cjkcodecs/multibytecodec.c4
-rw-r--r--Modules/posixmodule.c31
-rw-r--r--Modules/selectmodule.c18
12 files changed, 62 insertions, 61 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 869e3f8..564f559 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -370,8 +370,8 @@ _locale_strcoll_impl(PyObject *module, PyObject *os1, PyObject *os2)
result = PyLong_FromLong(wcscoll(ws1, ws2));
done:
/* Deallocate everything. */
- if (ws1) PyMem_FREE(ws1);
- if (ws2) PyMem_FREE(ws2);
+ if (ws1) PyMem_Free(ws1);
+ if (ws2) PyMem_Free(ws2);
return result;
}
#endif
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index ed8afef..7ecaeea 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -442,7 +442,7 @@ Pdata_dealloc(Pdata *self)
while (--i >= 0) {
Py_DECREF(self->data[i]);
}
- PyMem_FREE(self->data);
+ PyMem_Free(self->data);
PyObject_Del(self);
}
@@ -465,7 +465,7 @@ Pdata_New(void)
self->mark_set = 0;
self->fence = 0;
self->allocated = 8;
- self->data = PyMem_MALLOC(self->allocated * sizeof(PyObject *));
+ self->data = PyMem_Malloc(self->allocated * sizeof(PyObject *));
if (self->data)
return (PyObject *)self;
Py_DECREF(self);
@@ -726,7 +726,7 @@ static PyTypeObject Unpickler_Type;
static PyMemoTable *
PyMemoTable_New(void)
{
- PyMemoTable *memo = PyMem_MALLOC(sizeof(PyMemoTable));
+ PyMemoTable *memo = PyMem_Malloc(sizeof(PyMemoTable));
if (memo == NULL) {
PyErr_NoMemory();
return NULL;
@@ -735,9 +735,9 @@ PyMemoTable_New(void)
memo->mt_used = 0;
memo->mt_allocated = MT_MINSIZE;
memo->mt_mask = MT_MINSIZE - 1;
- memo->mt_table = PyMem_MALLOC(MT_MINSIZE * sizeof(PyMemoEntry));
+ memo->mt_table = PyMem_Malloc(MT_MINSIZE * sizeof(PyMemoEntry));
if (memo->mt_table == NULL) {
- PyMem_FREE(memo);
+ PyMem_Free(memo);
PyErr_NoMemory();
return NULL;
}
@@ -758,10 +758,10 @@ PyMemoTable_Copy(PyMemoTable *self)
new->mt_mask = self->mt_mask;
/* The table we get from _New() is probably smaller than we wanted.
Free it and allocate one that's the right size. */
- PyMem_FREE(new->mt_table);
+ PyMem_Free(new->mt_table);
new->mt_table = PyMem_NEW(PyMemoEntry, self->mt_allocated);
if (new->mt_table == NULL) {
- PyMem_FREE(new);
+ PyMem_Free(new);
PyErr_NoMemory();
return NULL;
}
@@ -800,8 +800,8 @@ PyMemoTable_Del(PyMemoTable *self)
return;
PyMemoTable_Clear(self);
- PyMem_FREE(self->mt_table);
- PyMem_FREE(self);
+ PyMem_Free(self->mt_table);
+ PyMem_Free(self);
}
/* Since entries cannot be deleted from this hashtable, _PyMemoTable_Lookup()
@@ -880,7 +880,7 @@ _PyMemoTable_ResizeTable(PyMemoTable *self, size_t min_size)
}
/* Deallocate the old table. */
- PyMem_FREE(oldtable);
+ PyMem_Free(oldtable);
return 0;
}
@@ -1582,7 +1582,7 @@ _Unpickler_MemoCleanup(UnpicklerObject *self)
while (--i >= 0) {
Py_XDECREF(memo[i]);
}
- PyMem_FREE(memo);
+ PyMem_Free(memo);
}
static UnpicklerObject *
@@ -7544,7 +7544,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj, void *Py_UNUSED(ignored
for (size_t i = new_memo_size - 1; i != SIZE_MAX; i--) {
Py_XDECREF(new_memo[i]);
}
- PyMem_FREE(new_memo);
+ PyMem_Free(new_memo);
}
return -1;
}
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 0a5ca60..c67f38d 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -197,7 +197,7 @@ static void
data_stack_dealloc(SRE_STATE* state)
{
if (state->data_stack) {
- PyMem_FREE(state->data_stack);
+ PyMem_Free(state->data_stack);
state->data_stack = NULL;
}
state->data_stack_size = state->data_stack_base = 0;
@@ -213,7 +213,7 @@ data_stack_grow(SRE_STATE* state, Py_ssize_t size)
void* stack;
cursize = minsize+minsize/4+1024;
TRACE(("allocate/grow stack %zd\n", cursize));
- stack = PyMem_REALLOC(state->data_stack, cursize);
+ stack = PyMem_Realloc(state->data_stack, cursize);
if (!stack) {
data_stack_dealloc(state);
return SRE_ERROR_MEMORY;
@@ -472,7 +472,7 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,
/* We add an explicit cast here because MSVC has a bug when
compiling C code where it believes that `const void**` cannot be
safely casted to `void*`, see bpo-39943 for details. */
- PyMem_Del((void*) state->mark);
+ PyMem_Free((void*) state->mark);
state->mark = NULL;
if (state->buffer.buf)
PyBuffer_Release(&state->buffer);
@@ -487,7 +487,7 @@ state_fini(SRE_STATE* state)
Py_XDECREF(state->string);
data_stack_dealloc(state);
/* See above PyMem_Del for why we explicitly cast here. */
- PyMem_Del((void*) state->mark);
+ PyMem_Free((void*) state->mark);
state->mark = NULL;
}
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 6f799ee..87fe3a1 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3306,10 +3306,10 @@ context_dealloc(PySSLContext *self)
context_clear(self);
SSL_CTX_free(self->ctx);
#if HAVE_NPN
- PyMem_FREE(self->npn_protocols);
+ PyMem_Free(self->npn_protocols);
#endif
#if HAVE_ALPN
- PyMem_FREE(self->alpn_protocols);
+ PyMem_Free(self->alpn_protocols);
#endif
Py_TYPE(self)->tp_free(self);
Py_DECREF(tp);
@@ -3510,7 +3510,7 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self,
return NULL;
}
- PyMem_FREE(self->alpn_protocols);
+ PyMem_Free(self->alpn_protocols);
self->alpn_protocols = PyMem_Malloc(protos->len);
if (!self->alpn_protocols)
return PyErr_NoMemory();
diff --git a/Modules/_struct.c b/Modules/_struct.c
index eeccc17..c95c76f 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1373,14 +1373,14 @@ prepare_s(PyStructObject *self)
self->s_size = size;
self->s_len = len;
- codes = PyMem_MALLOC((ncodes + 1) * sizeof(formatcode));
+ codes = PyMem_Malloc((ncodes + 1) * sizeof(formatcode));
if (codes == NULL) {
PyErr_NoMemory();
return -1;
}
/* Free any s_codes value left over from a previous initialization. */
if (self->s_codes != NULL)
- PyMem_FREE(self->s_codes);
+ PyMem_Free(self->s_codes);
self->s_codes = codes;
s = fmt;
@@ -1502,7 +1502,7 @@ s_dealloc(PyStructObject *s)
if (s->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *)s);
if (s->s_codes != NULL) {
- PyMem_FREE(s->s_codes);
+ PyMem_Free(s->s_codes);
}
Py_XDECREF(s->s_format);
freefunc free_func = PyType_GetSlot(Py_TYPE(s), Py_tp_free);
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index a1d4c92..916d10a 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1988,12 +1988,12 @@ unicode_asucs4(PyObject *self, PyObject *args)
buffer[str_len] = 0xffffU;
if (!PyUnicode_AsUCS4(unicode, buffer, buf_len, copy_null)) {
- PyMem_FREE(buffer);
+ PyMem_Free(buffer);
return NULL;
}
result = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer, buf_len);
- PyMem_FREE(buffer);
+ PyMem_Free(buffer);
return result;
}
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 56ed8a2..dcefa8d 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1056,7 +1056,7 @@ t_bootstrap(void *boot_raw)
Py_DECREF(boot->func);
Py_DECREF(boot->args);
Py_XDECREF(boot->keyw);
- PyMem_DEL(boot_raw);
+ PyMem_Free(boot_raw);
tstate->interp->num_threads--;
PyThreadState_Clear(tstate);
_PyThreadState_DeleteCurrent(tstate);
@@ -1107,7 +1107,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
boot->tstate = _PyThreadState_Prealloc(boot->interp);
boot->runtime = runtime;
if (boot->tstate == NULL) {
- PyMem_DEL(boot);
+ PyMem_Free(boot);
return PyErr_NoMemory();
}
Py_INCREF(func);
@@ -1121,7 +1121,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
Py_DECREF(args);
Py_XDECREF(keyw);
PyThreadState_Clear(boot->tstate);
- PyMem_DEL(boot);
+ PyMem_Free(boot);
return NULL;
}
return PyLong_FromUnsignedLong(ident);
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index b30141d..24aeb3d 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2472,7 +2472,7 @@ PythonCmdDelete(ClientData clientData)
ENTER_PYTHON
Py_XDECREF(data->self);
Py_XDECREF(data->func);
- PyMem_DEL(data);
+ PyMem_Free(data);
LEAVE_PYTHON
}
@@ -2545,7 +2545,7 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name,
CommandEvent *ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent));
if (ev == NULL) {
PyErr_NoMemory();
- PyMem_DEL(data);
+ PyMem_Free(data);
return NULL;
}
ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
@@ -2568,7 +2568,7 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name,
}
if (err) {
PyErr_SetString(Tkinter_TclError, "can't create Tcl command");
- PyMem_DEL(data);
+ PyMem_Free(data);
return NULL;
}
@@ -2666,7 +2666,7 @@ DeleteFHCD(int id)
*pp = p->next;
Py_XDECREF(p->func);
Py_XDECREF(p->file);
- PyMem_DEL(p);
+ PyMem_Free(p);
}
else
pp = &p->next;
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 2ba2ff4..6583e66 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -133,7 +133,7 @@ array_resize(arrayobject *self, Py_ssize_t newsize)
}
if (newsize == 0) {
- PyMem_FREE(self->ob_item);
+ PyMem_Free(self->ob_item);
self->ob_item = NULL;
Py_SET_SIZE(self, 0);
self->allocated = 0;
@@ -652,7 +652,7 @@ array_dealloc(arrayobject *op)
if (op->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) op);
if (op->ob_item != NULL)
- PyMem_DEL(op->ob_item);
+ PyMem_Free(op->ob_item);
Py_TYPE(op)->tp_free((PyObject *)op);
}
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 8640276..37a80a7 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -1191,13 +1191,13 @@ _multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDeco
goto errorexit;
if (wdata != data)
- PyMem_Del(wdata);
+ PyMem_Free(wdata);
Py_XDECREF(buf.excobj);
return res;
errorexit:
if (wdata != NULL && wdata != data)
- PyMem_Del(wdata);
+ PyMem_Free(wdata);
Py_XDECREF(buf.excobj);
_PyUnicodeWriter_Dealloc(&buf.writer);
return NULL;
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index efa9653..3e6e658 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5480,7 +5480,7 @@ free_string_array(EXECV_CHAR **array, Py_ssize_t count)
Py_ssize_t i;
for (i = 0; i < count; i++)
PyMem_Free(array[i]);
- PyMem_DEL(array);
+ PyMem_Free(array);
}
static int
@@ -6510,9 +6510,10 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
res = Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
fail_2:
- while (--envc >= 0)
- PyMem_DEL(envlist[envc]);
- PyMem_DEL(envlist);
+ while (--envc >= 0) {
+ PyMem_Free(envlist[envc]);
+ }
+ PyMem_Free(envlist);
fail_1:
free_string_array(argvlist, lastarg);
fail_0:
@@ -7444,7 +7445,7 @@ os_getgrouplist_impl(PyObject *module, const char *user, gid_t basegid)
list = PyList_New(ngroups);
if (list == NULL) {
- PyMem_Del(groups);
+ PyMem_Free(groups);
return NULL;
}
@@ -7456,13 +7457,13 @@ os_getgrouplist_impl(PyObject *module, const char *user, gid_t basegid)
#endif
if (o == NULL) {
Py_DECREF(list);
- PyMem_Del(groups);
+ PyMem_Free(groups);
return NULL;
}
PyList_SET_ITEM(list, i, o);
}
- PyMem_Del(groups);
+ PyMem_Free(groups);
return list;
}
@@ -9407,7 +9408,7 @@ iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, Py_ssize_t cnt, in
*buf = PyMem_New(Py_buffer, cnt);
if (*buf == NULL) {
- PyMem_Del(*iov);
+ PyMem_Free(*iov);
PyErr_NoMemory();
return -1;
}
@@ -9427,11 +9428,11 @@ iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, Py_ssize_t cnt, in
return 0;
fail:
- PyMem_Del(*iov);
+ PyMem_Free(*iov);
for (j = 0; j < i; j++) {
PyBuffer_Release(&(*buf)[j]);
}
- PyMem_Del(*buf);
+ PyMem_Free(*buf);
return -1;
}
@@ -9439,11 +9440,11 @@ static void
iov_cleanup(struct iovec *iov, Py_buffer *buf, int cnt)
{
int i;
- PyMem_Del(iov);
+ PyMem_Free(iov);
for (i = 0; i < cnt; i++) {
PyBuffer_Release(&buf[i]);
}
- PyMem_Del(buf);
+ PyMem_Free(buf);
}
#endif
@@ -12815,7 +12816,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks)
path_error(path);
break;
}
- buffer = PyMem_MALLOC(buffer_size);
+ buffer = PyMem_Malloc(buffer_size);
if (!buffer) {
PyErr_NoMemory();
break;
@@ -12832,7 +12833,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks)
if (length < 0) {
if (errno == ERANGE) {
- PyMem_FREE(buffer);
+ PyMem_Free(buffer);
buffer = NULL;
continue;
}
@@ -12870,7 +12871,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks)
}
exit:
if (buffer)
- PyMem_FREE(buffer);
+ PyMem_Free(buffer);
return result;
}
#endif /* USE_XATTRS */
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 693a833..0b9f20d 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -294,9 +294,9 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
wfd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1);
efd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1);
if (rfd2obj == NULL || wfd2obj == NULL || efd2obj == NULL) {
- if (rfd2obj) PyMem_DEL(rfd2obj);
- if (wfd2obj) PyMem_DEL(wfd2obj);
- if (efd2obj) PyMem_DEL(efd2obj);
+ if (rfd2obj) PyMem_Free(rfd2obj);
+ if (wfd2obj) PyMem_Free(wfd2obj);
+ if (efd2obj) PyMem_Free(efd2obj);
return PyErr_NoMemory();
}
#endif /* SELECT_USES_HEAP */
@@ -381,9 +381,9 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
reap_obj(wfd2obj);
reap_obj(efd2obj);
#ifdef SELECT_USES_HEAP
- PyMem_DEL(rfd2obj);
- PyMem_DEL(wfd2obj);
- PyMem_DEL(efd2obj);
+ PyMem_Free(rfd2obj);
+ PyMem_Free(wfd2obj);
+ PyMem_Free(efd2obj);
#endif /* SELECT_USES_HEAP */
return ret;
}
@@ -740,7 +740,7 @@ poll_dealloc(pollObject *self)
{
PyObject* type = (PyObject *)Py_TYPE(self);
if (self->ufds != NULL)
- PyMem_DEL(self->ufds);
+ PyMem_Free(self->ufds);
Py_XDECREF(self->dict);
PyObject_Del(self);
Py_DECREF(type);
@@ -1106,7 +1106,7 @@ newDevPollObject(PyObject *module)
self = PyObject_New(devpollObject, get_select_state(module)->devpoll_Type);
if (self == NULL) {
close(fd_devpoll);
- PyMem_DEL(fds);
+ PyMem_Free(fds);
return NULL;
}
self->fd_devpoll = fd_devpoll;
@@ -1129,7 +1129,7 @@ devpoll_dealloc(devpollObject *self)
{
PyObject *type = (PyObject *)Py_TYPE(self);
(void)devpoll_internal_close(self);
- PyMem_DEL(self->fds);
+ PyMem_Free(self->fds);
PyObject_Del(self);
Py_DECREF(type);
}