]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/python/as.c
python: Remove local stringpool and ctx from AS class
[people/ms/libloc.git] / src / python / as.c
index a28727d6f36d1de1aed3f8249e28a0b5b845a33a..44b959cdef7e04be13878aebc6bce0825dd9dc0e 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <loc/libloc.h>
 #include <loc/as.h>
-#include <loc/stringpool.h>
 
 #include "locationmodule.h"
 #include "as.h"
@@ -33,17 +32,7 @@ PyObject* new_as(PyTypeObject* type, struct loc_as* as) {
 }
 
 static PyObject* AS_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
-       // Create stringpool
-       struct loc_stringpool* pool;
-       int r = loc_stringpool_new(loc_ctx, &pool);
-       if (r)
-               return NULL;
-
        ASObject* self = (ASObject*)type->tp_alloc(type, 0);
-       if (self) {
-               self->ctx = loc_ref(loc_ctx);
-               self->pool = pool;
-       }
 
        return (PyObject*)self;
 }
@@ -52,12 +41,6 @@ static void AS_dealloc(ASObject* self) {
        if (self->as)
                loc_as_unref(self->as);
 
-       if (self->pool)
-               loc_stringpool_unref(self->pool);
-
-       if (self->ctx)
-               loc_unref(self->ctx);
-
        Py_TYPE(self)->tp_free((PyObject* )self);
 }
 
@@ -68,7 +51,7 @@ static int AS_init(ASObject* self, PyObject* args, PyObject* kwargs) {
                return -1;
 
        // Create the AS object
-       int r = loc_as_new(self->ctx, self->pool, &self->as, number);
+       int r = loc_as_new(loc_ctx, NULL, &self->as, number);
        if (r)
                return -1;