From: Denys Vlasenko Date: Tue, 30 Jan 2018 16:39:57 +0000 (+0100) Subject: gzip: code shrink (consolidate zeroing on reinit) X-Git-Tag: 1_29_0~324 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c6d2a26fac47eafc08f291dab78bbca3088f8ca2;p=oweals%2Fbusybox.git gzip: code shrink (consolidate zeroing on reinit) function old new delta deflate - 938 +938 pack_gzip 1903 923 -980 Signed-off-by: Denys Vlasenko --- diff --git a/archival/gzip.c b/archival/gzip.c index 2a5288cce..10eda7aa3 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -15,21 +15,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ -/* big objects in bss: - * 00000020 b bl_count - * 00000074 b base_length - * 00000078 b base_dist - * 00000078 b static_dtree - * 0000009c b bl_tree - * 000000f4 b dyn_dtree - * 00000100 b length_code - * 00000200 b dist_code - * 0000023d b depth - * 00000400 b flag_buf - * 0000047a b heap - * 00000480 b static_ltree - * 000008f4 b dyn_ltree - */ /* TODO: full support for -v for DESKTOP * "/usr/bin/gzip -v a bogus aa" should say: a: 85.1% -- replaced with a.gz @@ -351,6 +336,44 @@ struct globals { unsigned match_start; /* start of matching string */ unsigned lookahead; /* number of valid bytes ahead in window */ +/* number of input bytes */ + ulg isize; /* only 32 bits stored in .gz file */ + +/* bbox always use stdin/stdout */ +#define ifd STDIN_FILENO /* input file descriptor */ +#define ofd STDOUT_FILENO /* output file descriptor */ + +#ifdef DEBUG + unsigned insize; /* valid bytes in l_buf */ +#endif + unsigned outcnt; /* bytes in output buffer */ + + smallint eofile; /* flag set at end of input file */ + +/* =========================================================================== + * Local data used by the "bit string" routines. + */ + + unsigned short bi_buf; + +/* Output buffer. bits are inserted starting at the bottom (least significant + * bits). + */ +#undef BUF_SIZE +#define BUF_SIZE (8 * sizeof(G1.bi_buf)) + +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + int bi_valid; + +#ifdef DEBUG + ulg bits_sent; /* bit length of the compressed data */ +#endif + + /*uint32_t *crc_32_tab;*/ + uint32_t crc; /* shift register contents */ + /* =========================================================================== */ #define DECLARE(type, array, size) \ @@ -390,47 +413,6 @@ struct globals { /* Heads of the hash chains or 0. */ /* DECLARE(Pos, head, 1<