summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-03-01 13:37:58 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2013-03-01 13:37:58 (GMT)
commitc09fd27c0a1bc45b3bca4347f3ef7713c3898656 (patch)
treeca2506ed095a9c75550366821b255ee915d91400
parent2fe5fed2dfea4ffdb8af5f6352ea2c19641de3bd (diff)
downloadbusybox-c09fd27c0a1bc45b3bca4347f3ef7713c3898656.tar.gz
busybox-c09fd27c0a1bc45b3bca4347f3ef7713c3898656.tar.bz2
decompress_unlzma: make "fast" version a bit smaller
It is not slower. In fact it seems a tiny bit faster too. text data bss dec hex filename 2827 0 0 2827 b0b decompress_unlzma.o 2797 0 0 2797 aed decompress_unlzma.o Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/libarchive/decompress_unlzma.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c
index cfde8ea..dd08e77 100644
--- a/archival/libarchive/decompress_unlzma.c
+++ b/archival/libarchive/decompress_unlzma.c
@@ -45,16 +45,16 @@ typedef struct {
#define RC_MODEL_TOTAL_BITS 11
-/* Called twice: once at startup (LZMA_FAST only) and once in rc_normalize() */
-static size_inline void rc_read(rc_t *rc)
+/* Called once in rc_do_normalize() */
+static void rc_read(rc_t *rc)
{
int buffer_size = safe_read(rc->fd, RC_BUFFER, RC_BUFFER_SIZE);
//TODO: return -1 instead
//This will make unlzma delete broken unpacked file on unpack errors
if (buffer_size <= 0)
bb_error_msg_and_die("unexpected EOF");
- rc->ptr = RC_BUFFER;
rc->buffer_end = RC_BUFFER + buffer_size;
+ rc->ptr = RC_BUFFER;
}
/* Called twice, but one callsite is in speed_inline'd rc_is_bit_1() */
@@ -78,15 +78,9 @@ static ALWAYS_INLINE rc_t* rc_init(int fd) /*, int buffer_size) */
/* rc->ptr = rc->buffer_end; */
for (i = 0; i < 5; i++) {
-#if ENABLE_FEATURE_LZMA_FAST
- if (rc->ptr >= rc->buffer_end)
- rc_read(rc);
- rc->code = (rc->code << 8) | *rc->ptr++;
-#else
rc_do_normalize(rc);
-#endif
}
- rc->range = 0xFFFFFFFF;
+ rc->range = 0xffffffff;
return rc;
}