python: Remove reference to context from database
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Dec 2017 14:07:42 +0000 (14:07 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Dec 2017 14:07:42 +0000 (14:07 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/database.c
src/python/database.h

index 53b454c..69399b3 100644 (file)
@@ -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
index 8155cbd..2609d1b 100644 (file)
 
 #include <Python.h>
 
+#include <loc/database.h>
+
 typedef struct {
        PyObject_HEAD
-       struct loc_ctx* ctx;
        struct loc_database* db;
 } DatabaseObject;