From: Michael Tremer Date: Fri, 29 Dec 2017 14:07:42 +0000 (+0000) Subject: python: Remove reference to context from database X-Git-Tag: 0.9.0~149 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=38e07ee0a4ace01bda3a50e6dbe0de719f485f06 python: Remove reference to context from database Signed-off-by: Michael Tremer --- diff --git a/src/python/database.c b/src/python/database.c index 53b454c..69399b3 100644 --- a/src/python/database.c +++ b/src/python/database.c @@ -25,9 +25,6 @@ static PyObject* Database_new(PyTypeObject* type, PyObject* args, PyObject* kwds) { DatabaseObject* self = (DatabaseObject*)type->tp_alloc(type, 0); - if (self) { - self->ctx = loc_ref(loc_ctx); - } return (PyObject*)self; } @@ -36,9 +33,6 @@ static void Database_dealloc(DatabaseObject* self) { if (self->db) loc_database_unref(self->db); - if (self->ctx) - loc_unref(self->ctx); - Py_TYPE(self)->tp_free((PyObject* )self); } @@ -54,7 +48,7 @@ static int Database_init(DatabaseObject* self, PyObject* args, PyObject* kwargs) return -1; // Load the database - int r = loc_database_new(self->ctx, &self->db, f); + int r = loc_database_new(loc_ctx, &self->db, f); fclose(f); // Return on any errors diff --git a/src/python/database.h b/src/python/database.h index 8155cbd..2609d1b 100644 --- a/src/python/database.h +++ b/src/python/database.h @@ -19,9 +19,10 @@ #include +#include + typedef struct { PyObject_HEAD - struct loc_ctx* ctx; struct loc_database* db; } DatabaseObject;