diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-22 15:33:15 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-22 15:33:15 (GMT) |
commit | dcc819a5c9e3cb60eba05a3c0b2547bc1fb28b80 (patch) | |
tree | 124d72d29df550ba35d3a4b6ba66232619c85ee1 | |
parent | a1a9c51a3ef06614413f45d51e65588bcd0793f2 (diff) | |
download | cpython-dcc819a5c9e3cb60eba05a3c0b2547bc1fb28b80.zip cpython-dcc819a5c9e3cb60eba05a3c0b2547bc1fb28b80.tar.gz cpython-dcc819a5c9e3cb60eba05a3c0b2547bc1fb28b80.tar.bz2 |
Use pymalloc if it's enabled.
-rw-r--r-- | Modules/gcmodule.c | 8 | ||||
-rw-r--r-- | Objects/dictobject.c | 4 | ||||
-rw-r--r-- | Objects/rangeobject.c | 4 | ||||
-rw-r--r-- | Objects/sliceobject.c | 4 | ||||
-rw-r--r-- | Objects/stringobject.c | 14 | ||||
-rw-r--r-- | Objects/structseq.c | 4 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 10 |
7 files changed, 24 insertions, 24 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index d883b91..23a137e 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -829,7 +829,7 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int nitems) const size_t basicsize = _PyObject_VAR_SIZE(tp, nitems); #ifdef WITH_CYCLE_GC const size_t nbytes = sizeof(PyGC_Head) + basicsize; - PyGC_Head *g = PyObject_MALLOC(nbytes); + PyGC_Head *g = _PyMalloc_MALLOC(nbytes); if (g == NULL) return (PyObject *)PyErr_NoMemory(); g->gc.gc_next = NULL; @@ -845,7 +845,7 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int nitems) } op = FROM_GC(g); #else - op = PyObject_MALLOC(basicsize); + op = _PyMalloc_MALLOC(basicsize); if (op == NULL) return (PyObject *)PyErr_NoMemory(); @@ -896,9 +896,9 @@ _PyObject_GC_Del(PyObject *op) if (allocated > 0) { allocated--; } - PyObject_FREE(g); + _PyMalloc_FREE(g); #else - PyObject_FREE(op); + _PyMalloc_FREE(op); #endif } diff --git a/Objects/dictobject.c b/Objects/dictobject.c index e843e76..5803c57 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1914,7 +1914,7 @@ static PyObject * dictiter_new(dictobject *dict, binaryfunc select) { dictiterobject *di; - di = PyObject_NEW(dictiterobject, &PyDictIter_Type); + di = PyMalloc_New(dictiterobject, &PyDictIter_Type); if (di == NULL) return NULL; Py_INCREF(dict); @@ -1929,7 +1929,7 @@ static void dictiter_dealloc(dictiterobject *di) { Py_DECREF(di->di_dict); - PyObject_DEL(di); + PyMalloc_Del(di); } static PyObject * diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index da791fa..fa7e660 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -60,7 +60,7 @@ PyObject * PyRange_New(long start, long len, long step, int reps) { long totlen = -1; - rangeobject *obj = PyObject_NEW(rangeobject, &PyRange_Type); + rangeobject *obj = PyMalloc_New(rangeobject, &PyRange_Type); if (obj == NULL) return NULL; @@ -104,7 +104,7 @@ PyRange_New(long start, long len, long step, int reps) static void range_dealloc(rangeobject *r) { - PyObject_DEL(r); + PyMalloc_Del(r); } static PyObject * diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 42cbf24..108ab27 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -60,7 +60,7 @@ PyObject _Py_EllipsisObject = { PyObject * PySlice_New(PyObject *start, PyObject *stop, PyObject *step) { - PySliceObject *obj = PyObject_NEW(PySliceObject, &PySlice_Type); + PySliceObject *obj = PyMalloc_New(PySliceObject, &PySlice_Type); if (obj == NULL) return NULL; @@ -115,7 +115,7 @@ slice_dealloc(PySliceObject *r) Py_DECREF(r->step); Py_DECREF(r->start); Py_DECREF(r->stop); - PyObject_DEL(r); + PyMalloc_Del(r); } static PyObject * diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 4fb5e93..b39d9e5 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -68,7 +68,7 @@ PyString_FromStringAndSize(const char *str, int size) /* PyObject_NewVar is inlined */ op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); + _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); PyObject_INIT_VAR(op, &PyString_Type, size); @@ -131,7 +131,7 @@ PyString_FromString(const char *str) /* PyObject_NewVar is inlined */ op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); + _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); PyObject_INIT_VAR(op, &PyString_Type, size); @@ -733,7 +733,7 @@ string_concat(register PyStringObject *a, register PyObject *bb) size = a->ob_size + b->ob_size; /* PyObject_NewVar is inlined */ op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); + _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); PyObject_INIT_VAR(op, &PyString_Type, size); @@ -780,7 +780,7 @@ string_repeat(register PyStringObject *a, register int n) return NULL; } op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + nbytes); + _PyMalloc_MALLOC(sizeof(PyStringObject) + nbytes); if (op == NULL) return PyErr_NoMemory(); PyObject_INIT_VAR(op, &PyString_Type, size); @@ -2789,7 +2789,7 @@ PyTypeObject PyString_Type = { 0, /* tp_init */ 0, /* tp_alloc */ string_new, /* tp_new */ - _PyObject_Del, /* tp_free */ + _PyMalloc_Del, /* tp_free */ }; void @@ -2841,10 +2841,10 @@ _PyString_Resize(PyObject **pv, int newsize) #endif _Py_ForgetReference(v); *pv = (PyObject *) - PyObject_REALLOC((char *)v, + _PyMalloc_REALLOC((char *)v, sizeof(PyStringObject) + newsize * sizeof(char)); if (*pv == NULL) { - PyObject_DEL(v); + PyMalloc_Del(v); PyErr_NoMemory(); return -1; } diff --git a/Objects/structseq.c b/Objects/structseq.c index 377dfeb..7231ce1 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -22,7 +22,7 @@ PyStructSequence_New(PyTypeObject *type) { PyStructSequence *obj; - obj = PyObject_New(PyStructSequence, type); + obj = PyMalloc_New(PyStructSequence, type); obj->ob_size = VISIBLE_SIZE_TP(type); return (PyObject*) obj; @@ -37,7 +37,7 @@ structseq_dealloc(PyStructSequence *obj) for (i = 0; i < size; ++i) { Py_XDECREF(obj->ob_item[i]); } - PyObject_FREE(obj); + PyMalloc_Del(obj); } static int diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 978ac54..73d5d9d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -201,7 +201,7 @@ PyUnicodeObject *_PyUnicode_New(int length) PyObject_INIT(unicode, &PyUnicode_Type); } else { - unicode = PyObject_NEW(PyUnicodeObject, &PyUnicode_Type); + unicode = PyMalloc_New(PyUnicodeObject, &PyUnicode_Type); if (unicode == NULL) return NULL; unicode->str = PyMem_NEW(Py_UNICODE, length + 1); @@ -219,7 +219,7 @@ PyUnicodeObject *_PyUnicode_New(int length) onError: _Py_ForgetReference((PyObject *)unicode); - PyObject_DEL(unicode); + PyMalloc_Del(unicode); return NULL; } @@ -5711,7 +5711,7 @@ unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) pnew->str = PyMem_NEW(Py_UNICODE, n+1); if (pnew->str == NULL) { _Py_ForgetReference((PyObject *)pnew); - PyObject_DEL(pnew); + PyMalloc_Del(pnew); return NULL; } Py_UNICODE_COPY(pnew->str, tmp->str, n+1); @@ -5769,7 +5769,7 @@ PyTypeObject PyUnicode_Type = { 0, /* tp_init */ 0, /* tp_alloc */ unicode_new, /* tp_new */ - _PyObject_Del, /* tp_free */ + _PyMalloc_Del, /* tp_free */ }; /* Initialize the Unicode implementation */ @@ -5811,7 +5811,7 @@ _PyUnicode_Fini(void) if (v->str) PyMem_DEL(v->str); Py_XDECREF(v->defenc); - PyObject_DEL(v); + PyMalloc_Del(v); } unicode_freelist = NULL; unicode_freelist_size = 0; |