Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#include "archive.h"
#include "errors.h"
+#include "file.h"
#include "key.h"
#include "package.h"
if (!file)
goto ERROR;
- // Fetch the path
- const char* path = pakfire_file_get_path(file);
-
- // Convert path to string
- PyObject* obj = PyUnicode_FromString(path);
+ // Create a new File object
+ PyObject* obj = new_file(file);
+ if (!obj)
+ goto ERROR;
// Append the new object to the list
r = PyList_Append(list, obj);
Py_DECREF(obj);
// If we could not append to the list, we will break
- if (r) {
- Py_DECREF(list);
- list = NULL;
+ if (r)
goto ERROR;
- }
// Free file
pakfire_file_unref(file);
}
+ goto OUT;
+
ERROR:
+ if (list) {
+ Py_DECREF(list);
+ list = NULL;
+ }
+
+OUT:
if (filelist)
pakfire_filelist_unref(filelist);