[Python-checkins] CVS: python/dist/src/Objects object.c,2.166,2.167
Neil Schemenauer
nascheme@users.sourceforge.net
Fri, 22 Mar 2002 07:28:33 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv17478/Objects
Modified Files:
object.c
Log Message:
Add pymalloc object memory management functions. These must be
available even if pymalloc is disabled since extension modules might use
them.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.166
retrieving revision 2.167
diff -C2 -d -r2.166 -r2.167
*** object.c 18 Mar 2002 21:05:57 -0000 2.166
--- object.c 22 Mar 2002 15:28:30 -0000 2.167
***************
*** 2110,2111 ****
--- 2110,2135 ----
}
#endif /* !WITH_PYMALLOC */
+
+ PyObject *_PyMalloc_New(PyTypeObject *tp)
+ {
+ PyObject *op;
+ op = (PyObject *) _PyMalloc_MALLOC(_PyObject_SIZE(tp));
+ if (op == NULL)
+ return PyErr_NoMemory();
+ return PyObject_INIT(op, tp);
+ }
+
+ PyVarObject *_PyMalloc_NewVar(PyTypeObject *tp, int nitems)
+ {
+ PyVarObject *op;
+ const size_t size = _PyObject_VAR_SIZE(tp, nitems);
+ op = (PyVarObject *) _PyMalloc_MALLOC(size);
+ if (op == NULL)
+ return (PyVarObject *)PyErr_NoMemory();
+ return PyObject_INIT_VAR(op, tp, nitems);
+ }
+
+ void _PyMalloc_Del(PyObject *op)
+ {
+ _PyMalloc_FREE(op);
+ }