aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-03-01 14:37:58 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-03-01 14:37:58 +0100
commitc09fd27c0a1bc45b3bca4347f3ef7713c3898656 (patch)
treeca2506ed095a9c75550366821b255ee915d91400
parent2fe5fed2dfea4ffdb8af5f6352ea2c19641de3bd (diff)
downloadbusybox-w32-c09fd27c0a1bc45b3bca4347f3ef7713c3898656.tar.gz
busybox-w32-c09fd27c0a1bc45b3bca4347f3ef7713c3898656.tar.bz2
busybox-w32-c09fd27c0a1bc45b3bca4347f3ef7713c3898656.zip
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 cfde8ea56..dd08e77f3 100644
--- a/archival/libarchive/decompress_unlzma.c
+++ b/archival/libarchive/decompress_unlzma.c
@@ -45,16 +45,16 @@ typedef struct {
45#define RC_MODEL_TOTAL_BITS 11 45#define RC_MODEL_TOTAL_BITS 11
46 46
47 47
48/* Called twice: once at startup (LZMA_FAST only) and once in rc_normalize() */ 48/* Called once in rc_do_normalize() */
49static size_inline void rc_read(rc_t *rc) 49static void rc_read(rc_t *rc)
50{ 50{
51 int buffer_size = safe_read(rc->fd, RC_BUFFER, RC_BUFFER_SIZE); 51 int buffer_size = safe_read(rc->fd, RC_BUFFER, RC_BUFFER_SIZE);
52//TODO: return -1 instead 52//TODO: return -1 instead
53//This will make unlzma delete broken unpacked file on unpack errors 53//This will make unlzma delete broken unpacked file on unpack errors
54 if (buffer_size <= 0) 54 if (buffer_size <= 0)
55 bb_error_msg_and_die("unexpected EOF"); 55 bb_error_msg_and_die("unexpected EOF");
56 rc->ptr = RC_BUFFER;
57 rc->buffer_end = RC_BUFFER + buffer_size; 56 rc->buffer_end = RC_BUFFER + buffer_size;
57 rc->ptr = RC_BUFFER;
58} 58}
59 59
60/* Called twice, but one callsite is in speed_inline'd rc_is_bit_1() */ 60/* 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) */
78 /* rc->ptr = rc->buffer_end; */ 78 /* rc->ptr = rc->buffer_end; */
79 79
80 for (i = 0; i < 5; i++) { 80 for (i = 0; i < 5; i++) {
81#if ENABLE_FEATURE_LZMA_FAST
82 if (rc->ptr >= rc->buffer_end)
83 rc_read(rc);
84 rc->code = (rc->code << 8) | *rc->ptr++;
85#else
86 rc_do_normalize(rc); 81 rc_do_normalize(rc);
87#endif
88 } 82 }
89 rc->range = 0xFFFFFFFF; 83 rc->range = 0xffffffff;
90 return rc; 84 return rc;
91} 85}
92 86