From 2b208642be85a9b03250c6ac403d1bbd1b293336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 12 Aug 2015 03:12:06 +0200 Subject: add support for setting xz memlimit Change-Id: If7513a85c77692983bc2cb948f5b92eea3b304d8 --- rpmio/rpmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 60da8bea1..0c1a674dc 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -897,6 +897,7 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x LZFILE *lzfile; lzma_ret ret; lzma_stream init_strm = LZMA_STREAM_INIT; + uint64_t mem_limit = rpmExpandNumeric("%{_xz_memlimit}"); for (; *mode; mode++) { if (*mode == 'w') @@ -931,7 +932,7 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x ret = lzma_alone_encoder(&lzfile->strm, &options); } } else { /* lzma_easy_decoder_memusage(level) is not ready yet, use hardcoded limit for now */ - ret = lzma_auto_decoder(&lzfile->strm, 100<<20, 0); + ret = lzma_auto_decoder(&lzfile->strm, mem_limit ? mem_limit : 100<<20, 0); } if (ret != LZMA_OK) { switch (ret) { -- cgit v1.2.3