summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/lzop.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/archival/lzop.c b/archival/lzop.c
index ab4d34c..c6e718a 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -697,10 +697,16 @@ static NOINLINE smallint lzo_compress(const header_t *h)
return ok;
}
-static void lzo_check(uint32_t FAST_FUNC (*fn)(uint32_t, const uint8_t*, unsigned),
- uint32_t ref, uint32_t init,
- uint8_t* buf, unsigned len)
+static FAST_FUNC void lzo_check(
+ uint32_t init,
+ uint8_t* buf, unsigned len,
+ uint32_t FAST_FUNC (*fn)(uint32_t, const uint8_t*, unsigned),
+ uint32_t ref)
{
+ /* This function, by having the same order of parameters
+ * as fn, and by being marked FAST_FUNC (same as fn),
+ * saves a dozen bytes of code.
+ */
uint32_t c = fn(init, buf, len);
if (c != ref)
bb_error_msg_and_die("checksum error");
@@ -747,9 +753,8 @@ static NOINLINE smallint lzo_decompress(const header_t *h)
if (dst_len > block_size) {
if (b2) {
-//FIXME!
- b2 = NULL;
free(b2);
+ b2 = NULL;
}
block_size = dst_len;
mcs_block_size = MAX_COMPRESSED_SIZE(block_size);
@@ -781,13 +786,13 @@ static NOINLINE smallint lzo_decompress(const header_t *h)
if (!(option_mask32 & OPT_F)) {
/* verify checksum of compressed block */
if (h->flags & F_ADLER32_C)
- lzo_check(lzo_adler32, c_adler32,
- ADLER32_INIT_VALUE,
- b1, src_len);
+ lzo_check(ADLER32_INIT_VALUE,
+ b1, src_len,
+ lzo_adler32, c_adler32);
if (h->flags & F_CRC32_C)
- lzo_check(lzo_crc32, c_crc32,
- CRC32_INIT_VALUE,
- b1, src_len);
+ lzo_check(CRC32_INIT_VALUE,
+ b1, src_len,
+ lzo_crc32, c_crc32);
}
/* decompress */
@@ -808,11 +813,13 @@ static NOINLINE smallint lzo_decompress(const header_t *h)
if (!(option_mask32 & OPT_F)) {
/* verify checksum of uncompressed block */
if (h->flags & F_ADLER32_D)
- lzo_check(lzo_adler32, d_adler32, ADLER32_INIT_VALUE,
- dst, dst_len);
+ lzo_check(ADLER32_INIT_VALUE,
+ dst, dst_len,
+ lzo_adler32, d_adler32);
if (h->flags & F_CRC32_D)
- lzo_check(lzo_crc32, d_crc32, CRC32_INIT_VALUE,
- dst, dst_len);
+ lzo_check(CRC32_INIT_VALUE,
+ dst, dst_len,
+ lzo_crc32, d_crc32);
}
/* write uncompressed block data */