diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-04 19:46:52 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-04 19:46:52 +0200 |
commit | 8ae6e9be5c1c7e7a1e9ce96f463c7d6ab1c9500f (patch) | |
tree | 3f59a65cfc93d932cdf57fbe1cc3d627f215a0fe /archival | |
parent | 0d7cb4cc9ed557310a2cba8d30dfa38aee20cb49 (diff) |
lzop: fix misordered "v=NULL; free(v)", small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/lzop.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/archival/lzop.c b/archival/lzop.c index ab4d34c88..c6e718ad7 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 */ |