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 | |
parent | 0d7cb4cc9ed557310a2cba8d30dfa38aee20cb49 (diff) | |
download | busybox-w32-8ae6e9be5c1c7e7a1e9ce96f463c7d6ab1c9500f.tar.gz busybox-w32-8ae6e9be5c1c7e7a1e9ce96f463c7d6ab1c9500f.tar.bz2 busybox-w32-8ae6e9be5c1c7e7a1e9ce96f463c7d6ab1c9500f.zip |
lzop: fix misordered "v=NULL; free(v)", small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-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) | |||
697 | return ok; | 697 | return ok; |
698 | } | 698 | } |
699 | 699 | ||
700 | static void lzo_check(uint32_t FAST_FUNC (*fn)(uint32_t, const uint8_t*, unsigned), | 700 | static FAST_FUNC void lzo_check( |
701 | uint32_t ref, uint32_t init, | 701 | uint32_t init, |
702 | uint8_t* buf, unsigned len) | 702 | uint8_t* buf, unsigned len, |
703 | uint32_t FAST_FUNC (*fn)(uint32_t, const uint8_t*, unsigned), | ||
704 | uint32_t ref) | ||
703 | { | 705 | { |
706 | /* This function, by having the same order of parameters | ||
707 | * as fn, and by being marked FAST_FUNC (same as fn), | ||
708 | * saves a dozen bytes of code. | ||
709 | */ | ||
704 | uint32_t c = fn(init, buf, len); | 710 | uint32_t c = fn(init, buf, len); |
705 | if (c != ref) | 711 | if (c != ref) |
706 | bb_error_msg_and_die("checksum error"); | 712 | bb_error_msg_and_die("checksum error"); |
@@ -747,9 +753,8 @@ static NOINLINE smallint lzo_decompress(const header_t *h) | |||
747 | 753 | ||
748 | if (dst_len > block_size) { | 754 | if (dst_len > block_size) { |
749 | if (b2) { | 755 | if (b2) { |
750 | //FIXME! | ||
751 | b2 = NULL; | ||
752 | free(b2); | 756 | free(b2); |
757 | b2 = NULL; | ||
753 | } | 758 | } |
754 | block_size = dst_len; | 759 | block_size = dst_len; |
755 | mcs_block_size = MAX_COMPRESSED_SIZE(block_size); | 760 | mcs_block_size = MAX_COMPRESSED_SIZE(block_size); |
@@ -781,13 +786,13 @@ static NOINLINE smallint lzo_decompress(const header_t *h) | |||
781 | if (!(option_mask32 & OPT_F)) { | 786 | if (!(option_mask32 & OPT_F)) { |
782 | /* verify checksum of compressed block */ | 787 | /* verify checksum of compressed block */ |
783 | if (h->flags & F_ADLER32_C) | 788 | if (h->flags & F_ADLER32_C) |
784 | lzo_check(lzo_adler32, c_adler32, | 789 | lzo_check(ADLER32_INIT_VALUE, |
785 | ADLER32_INIT_VALUE, | 790 | b1, src_len, |
786 | b1, src_len); | 791 | lzo_adler32, c_adler32); |
787 | if (h->flags & F_CRC32_C) | 792 | if (h->flags & F_CRC32_C) |
788 | lzo_check(lzo_crc32, c_crc32, | 793 | lzo_check(CRC32_INIT_VALUE, |
789 | CRC32_INIT_VALUE, | 794 | b1, src_len, |
790 | b1, src_len); | 795 | lzo_crc32, c_crc32); |
791 | } | 796 | } |
792 | 797 | ||
793 | /* decompress */ | 798 | /* decompress */ |
@@ -808,11 +813,13 @@ static NOINLINE smallint lzo_decompress(const header_t *h) | |||
808 | if (!(option_mask32 & OPT_F)) { | 813 | if (!(option_mask32 & OPT_F)) { |
809 | /* verify checksum of uncompressed block */ | 814 | /* verify checksum of uncompressed block */ |
810 | if (h->flags & F_ADLER32_D) | 815 | if (h->flags & F_ADLER32_D) |
811 | lzo_check(lzo_adler32, d_adler32, ADLER32_INIT_VALUE, | 816 | lzo_check(ADLER32_INIT_VALUE, |
812 | dst, dst_len); | 817 | dst, dst_len, |
818 | lzo_adler32, d_adler32); | ||
813 | if (h->flags & F_CRC32_D) | 819 | if (h->flags & F_CRC32_D) |
814 | lzo_check(lzo_crc32, d_crc32, CRC32_INIT_VALUE, | 820 | lzo_check(CRC32_INIT_VALUE, |
815 | dst, dst_len); | 821 | dst, dst_len, |
822 | lzo_crc32, d_crc32); | ||
816 | } | 823 | } |
817 | 824 | ||
818 | /* write uncompressed block data */ | 825 | /* write uncompressed block data */ |