unxz: update from XZ embedded git
function old new delta
rc_reset - 21 +21
unpack_xz_stream 2342 2357 +15
lzma_reset 102 64 -38
lzma_len 506 443 -63
xz_dec_lzma2_run 1438 1374 -64
xz_dec_reset 73 - -73
lzma_main 2517 2183 -334
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/4 up/down: 36/-572) Total: -536 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/archival/libunarchive/unxz/xz_dec_stream.c b/archival/libunarchive/unxz/xz_dec_stream.c
index 21db283..bdcbf1b 100644
--- a/archival/libunarchive/unxz/xz_dec_stream.c
+++ b/archival/libunarchive/unxz/xz_dec_stream.c
@@ -48,8 +48,8 @@
/* Type of the integrity check calculated from uncompressed data */
enum xz_check check_type;
- /* True if we are operating in single-call mode. */
- bool single_call;
+ /* Operation mode */
+ enum xz_mode mode;
/*
* True if the next call to xz_dec_run() is allowed to return
@@ -737,14 +737,14 @@
size_t out_start;
enum xz_ret ret;
- if (s->single_call)
+ if (DEC_IS_SINGLE(s->mode))
xz_dec_reset(s);
in_start = b->in_pos;
out_start = b->out_pos;
ret = dec_main(s, b);
- if (s->single_call) {
+ if (DEC_IS_SINGLE(s->mode)) {
if (ret == XZ_OK)
ret = b->in_pos == b->in_size
? XZ_DATA_ERROR : XZ_BUF_ERROR;
@@ -767,21 +767,22 @@
return ret;
}
-XZ_EXTERN struct xz_dec * XZ_FUNC xz_dec_init(uint32_t dict_max)
+XZ_EXTERN struct xz_dec * XZ_FUNC xz_dec_init(
+ enum xz_mode mode, uint32_t dict_max)
{
struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL);
if (s == NULL)
return NULL;
- s->single_call = dict_max == 0;
+ s->mode = mode;
#ifdef XZ_DEC_BCJ
- s->bcj = xz_dec_bcj_create(s->single_call);
+ s->bcj = xz_dec_bcj_create(DEC_IS_SINGLE(mode));
if (s->bcj == NULL)
goto error_bcj;
#endif
- s->lzma2 = xz_dec_lzma2_create(dict_max);
+ s->lzma2 = xz_dec_lzma2_create(mode, dict_max);
if (s->lzma2 == NULL)
goto error_lzma2;