]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
python: Remove local stringpool and ctx from AS class
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Dec 2017 14:06:00 +0000 (14:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Dec 2017 14:06:00 +0000 (14:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/as.c
src/python/as.h

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;
 
index 19b5c73050eefdd413e9f856b53021c8dcbaf819..5bc72409b793e0956f70d2522f6f27200b7f68c8 100644 (file)
 
 #include <loc/libloc.h>
 #include <loc/as.h>
-#include <loc/stringpool.h>
 
 typedef struct {
        PyObject_HEAD
-       struct loc_ctx* ctx;
-       struct loc_stringpool* pool;
        struct loc_as* as;
 } ASObject;