refs: implement reference dealloc

This commit is contained in:
J. David Ibáñez
2011-12-20 22:19:15 +01:00
parent 5986688197
commit 584a8b1473
2 changed files with 9 additions and 3 deletions

View File

@@ -5,7 +5,6 @@ Signature
References References
========== ==========
- Free the git_reference struct.
- Wrap missing functions: git_reference_foreach, git_reference_is_packed, - Wrap missing functions: git_reference_foreach, git_reference_is_packed,
git_reference_reload git_reference_reload

View File

@@ -2364,6 +2364,13 @@ static PyTypeObject WalkerType = {
0, /* tp_new */ 0, /* tp_new */
}; };
static void
Reference_dealloc(Reference *self)
{
git_reference_free(self->reference);
PyObject_Del(self);
}
static PyObject * static PyObject *
Reference_delete(Reference *self, PyObject *args) Reference_delete(Reference *self, PyObject *args)
{ {
@@ -2569,7 +2576,7 @@ static PyTypeObject ReferenceType = {
"pygit2.Reference", /* tp_name */ "pygit2.Reference", /* tp_name */
sizeof(Reference), /* tp_basicsize */ sizeof(Reference), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
0, /* tp_dealloc */ (destructor)Reference_dealloc, /* tp_dealloc */
0, /* tp_print */ 0, /* tp_print */
0, /* tp_getattr */ 0, /* tp_getattr */
0, /* tp_setattr */ 0, /* tp_setattr */