summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-05-03 23:44:39 +0000
committerGuido van Rossum <guido@python.org>2000-05-03 23:44:39 +0000
commit2ad49d47ba5cf6a6c84baef80143cb2ab354744e (patch)
treeefae1e8b4dd63a06425818661fc2dbc74824d50c /PC
parentcb711cb64b882076d5e77c147b164eec755fcf2c (diff)
downloadcpython-2ad49d47ba5cf6a6c84baef80143cb2ab354744e.tar.gz
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 3dccc3db31..bba9bc2983 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 3dccc3db31..bba9bc2983 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");