]> git.ipfire.org Git - pakfire.git/commitdiff
python: Minor code cleanup
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2025 11:04:39 +0000 (11:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Feb 2025 11:04:39 +0000 (11:04 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/file.c
src/python/file.h
src/python/util.c

index 7c5e9cbece3a19c418083d3e7ebfe5b9f2650daf..ce36628244f59e4fd2faa29cedf1412cd8d52348 100644 (file)
@@ -28,9 +28,7 @@
 #include "pakfire.h"
 #include "util.h"
 
-PyObject* new_file(struct pakfire_file* file) {
-       PyTypeObject* type = &FileType;
-
+PyObject* new_file(PyTypeObject* type, struct pakfire_file* file) {
        FileObject* self = (FileObject *)type->tp_alloc(type, 0);
        if (self) {
                self->file = pakfire_file_ref(file);
index 3ce22aeb25fd6b1e926e3b420bea39150b068294..0494b688520bd388369bc6de4607ff6f619f6a1c 100644 (file)
@@ -32,6 +32,6 @@ typedef struct {
 
 extern PyTypeObject FileType;
 
-PyObject* new_file(struct pakfire_file* file);
+PyObject* new_file(PyTypeObject* type, struct pakfire_file* file);
 
 #endif /* PYTHON_PAKFIRE_FILE_H */
index f1abd0cd118fcb37d99848eea49b61fc20e4f19e..d0cdb73159c4bdd3946d56715686f225b54af4de 100644 (file)
@@ -98,7 +98,7 @@ PyObject* PyList_FromFileList(struct pakfire_filelist* filelist) {
                        goto ERROR;
 
                // Create a new File object
-               f = new_file(file);
+               f = new_file(&FileType, file);
                if (!f)
                        goto ERROR;