summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-05-03 23:44:39 (GMT)
committerGuido van Rossum <guido@python.org>2000-05-03 23:44:39 (GMT)
commitb18618dab7b6b85bb05b084693706e59211fa180 (patch)
tree785d51f6677da8366be2ad4b4296a62f53161276 /PC
parent2808b744e8d94459f189e1d89c97072d6a1f53b6 (diff)
downloadcpython-b18618dab7b6b85bb05b084693706e59211fa180.zip
cpython-b18618dab7b6b85bb05b084693706e59211fa180.tar.gz
cpython-b18618dab7b6b85bb05b084693706e59211fa180.tar.bz2
Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
Diffstat (limited to 'PC')
-rw-r--r--PC/_winreg.c12
-rw-r--r--PC/winreg.c12
2 files changed, 14 insertions, 10 deletions
diff --git a/PC/_winreg.c b/PC/_winreg.c
index 3dccc3d..bba9bc2 100644
--- a/PC/_winreg.c
+++ b/PC/_winreg.c
@@ -370,7 +370,7 @@ PyHKEY_deallocFunc(PyObject *ob)
PyHKEYObject *obkey = (PyHKEYObject *)ob;
if (obkey->hkey)
RegCloseKey((HKEY)obkey->hkey);
- PyMem_DEL(ob);
+ PyObject_DEL(ob);
}
static int
@@ -604,12 +604,14 @@ PyHKEY_AsHKEY(PyObject *ob, HKEY *pHANDLE, BOOL bNoneOK)
PyObject *
PyHKEY_FromHKEY(HKEY h)
{
- PyHKEYObject *op = (PyHKEYObject *) malloc(sizeof(PyHKEYObject));
+ PyHKEYObject *op;
+
+ /* PyObject_New is inlined */
+ op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject));
if (op == NULL)
return PyErr_NoMemory();
- op->ob_type = &PyHKEY_Type;
+ PyObject_INIT(op, &PyHKEY_Type);
op->hkey = h;
- _Py_NewReference((PyObject *)op);
return (PyObject *)op;
}
@@ -1348,7 +1350,7 @@ PySetValueEx(PyObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
rc = RegSetValueEx(hKey, valueName, 0, typ, data, len);
Py_END_ALLOW_THREADS
- PyMem_Free(data);
+ PyMem_DEL(data);
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegSetValueEx");
diff --git a/PC/winreg.c b/PC/winreg.c
index 3dccc3d..bba9bc2 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -370,7 +370,7 @@ PyHKEY_deallocFunc(PyObject *ob)
PyHKEYObject *obkey = (PyHKEYObject *)ob;
if (obkey->hkey)
RegCloseKey((HKEY)obkey->hkey);
- PyMem_DEL(ob);
+ PyObject_DEL(ob);
}
static int
@@ -604,12 +604,14 @@ PyHKEY_AsHKEY(PyObject *ob, HKEY *pHANDLE, BOOL bNoneOK)
PyObject *
PyHKEY_FromHKEY(HKEY h)
{
- PyHKEYObject *op = (PyHKEYObject *) malloc(sizeof(PyHKEYObject));
+ PyHKEYObject *op;
+
+ /* PyObject_New is inlined */
+ op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject));
if (op == NULL)
return PyErr_NoMemory();
- op->ob_type = &PyHKEY_Type;
+ PyObject_INIT(op, &PyHKEY_Type);
op->hkey = h;
- _Py_NewReference((PyObject *)op);
return (PyObject *)op;
}
@@ -1348,7 +1350,7 @@ PySetValueEx(PyObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
rc = RegSetValueEx(hKey, valueName, 0, typ, data, len);
Py_END_ALLOW_THREADS
- PyMem_Free(data);
+ PyMem_DEL(data);
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegSetValueEx");