]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/python/database.c
python: Only use global loc context
[people/ms/libloc.git] / src / python / database.c
index c29d912b00de4c10de1a82fb12b0e5303b31d537..e38256bfd7db0198a6eaabc7ab3fad8ed82e9210 100644 (file)
 #include <loc/libloc.h>
 #include <loc/database.h>
 
+#include "locationmodule.h"
 #include "database.h"
 
 static PyObject* Database_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
-       // Create libloc context
-       struct loc_ctx* ctx;
-       int r = loc_new(&ctx);
-       if (r)
-               return NULL;
-
        DatabaseObject* self = (DatabaseObject*)type->tp_alloc(type, 0);
        if (self) {
-               self->ctx = ctx;
+               self->ctx = loc_ref(loc_ctx);
        }
 
        return (PyObject*)self;