summaryrefslogtreecommitdiff
path: root/libappstream-builder/asb-utils.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-02-01 20:09:20 +0000
committerRichard Hughes <richard@hughsie.com>2015-02-01 20:09:22 +0000
commit5d4831194db76118b9ca5f8940ff6c96b2a7184e (patch)
treed5ae7d602a86afdbdee54be6093786def6d48b96 /libappstream-builder/asb-utils.c
parentdcb77b98fb5bf6eb13bf2688fd6a818634a2026a (diff)
downloadappstream-glib-5d4831194db76118b9ca5f8940ff6c96b2a7184e.tar.gz
Use archive_read_open_filename() to reduce the peak RSS at the expense of speed
Apparently, 4GB of RAM to process Fedora Rawhide is too much for my little microserver...
Diffstat (limited to 'libappstream-builder/asb-utils.c')
-rw-r--r--libappstream-builder/asb-utils.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c
index 8fb1078..9206843 100644
--- a/libappstream-builder/asb-utils.c
+++ b/libappstream-builder/asb-utils.c
@@ -301,25 +301,18 @@ asb_utils_explode (const gchar *filename,
const gchar *tmp;
gboolean ret = TRUE;
gboolean valid;
- gsize len;
int r;
struct archive *arch = NULL;
struct archive *arch_preview = NULL;
struct archive_entry *entry;
- _cleanup_free_ gchar *data = NULL;
_cleanup_hashtable_unref_ GHashTable *matches = NULL;
- /* load file at once to avoid seeking */
- ret = g_file_get_contents (filename, &data, &len, error);
- if (!ret)
- goto out;
-
/* populate a hash with all the files, symlinks and hardlinks that
* actually need decompressing */
arch_preview = archive_read_new ();
archive_read_support_format_all (arch_preview);
archive_read_support_filter_all (arch_preview);
- r = archive_read_open_memory (arch_preview, data, len);
+ r = archive_read_open_filename (arch_preview, filename, 1024 * 32);
if (r) {
ret = FALSE;
g_set_error (error,
@@ -377,7 +370,7 @@ asb_utils_explode (const gchar *filename,
arch = archive_read_new ();
archive_read_support_format_all (arch);
archive_read_support_filter_all (arch);
- r = archive_read_open_memory (arch, data, len);
+ r = archive_read_open_filename (arch, filename, 1024 * 32);
if (r) {
ret = FALSE;
g_set_error (error,