]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
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 53b454c4f6dde3dd9f1fd28055fbdf64e70793d7..69399b3db888d4ff419c8d8d2f84e1b148119ab8 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 8155cbd1144037fad32828db43efc6eeb3fa128b..2609d1bf78bb0b1b161a8068647e1da290f60fa6 100644 (file)
 
 #include <Python.h>
 
+#include <loc/database.h>
+
 typedef struct {
        PyObject_HEAD
-       struct loc_ctx* ctx;
        struct loc_database* db;
 } DatabaseObject;