aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-31 17:00:41 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-31 17:00:41 +0100
commitba63d70e2d3a24670813dc33fca4450a25b281b6 (patch)
treeaea19e6207eb634b4d8c4140ca10045333cc7f32
parent26eea71c87bb5b39fb77eb8b1a6c69ea82e8e879 (diff)
downloadbusybox-w32-ba63d70e2d3a24670813dc33fca4450a25b281b6.tar.gz
busybox-w32-ba63d70e2d3a24670813dc33fca4450a25b281b6.tar.bz2
busybox-w32-ba63d70e2d3a24670813dc33fca4450a25b281b6.zip
gzip: make debugging of bits_sent less ugly, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/gzip.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index c94fec48d..6083cde88 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -411,6 +411,9 @@ struct globals {
411 411
412#ifdef DEBUG 412#ifdef DEBUG
413 ulg bits_sent; /* bit length of the compressed data */ 413 ulg bits_sent; /* bit length of the compressed data */
414# define DEBUG_bits_sent(v) (void)(G1.bits_sent v)
415#else
416# define DEBUG_bits_sent(v) ((void)0)
414#endif 417#endif
415}; 418};
416 419
@@ -540,7 +543,7 @@ static void send_bits(unsigned value, unsigned length)
540#ifdef DEBUG 543#ifdef DEBUG
541 Tracev((stderr, " l %2d v %4x ", length, value)); 544 Tracev((stderr, " l %2d v %4x ", length, value));
542 Assert(length > 0 && length <= 15, "invalid length"); 545 Assert(length > 0 && length <= 15, "invalid length");
543 G1.bits_sent += length; 546 DEBUG_bits_sent(+= length);
544#endif 547#endif
545 BUILD_BUG_ON(BUF_SIZE != 32 && BUF_SIZE != 16); 548 BUILD_BUG_ON(BUF_SIZE != 32 && BUF_SIZE != 16);
546 549
@@ -602,9 +605,7 @@ static void bi_windup(void)
602 } 605 }
603 G1.bi_buf = 0; 606 G1.bi_buf = 0;
604 G1.bi_valid = 0; 607 G1.bi_valid = 0;
605#ifdef DEBUG 608 DEBUG_bits_sent(= (G1.bits_sent + 7) & ~7);
606 G1.bits_sent = (G1.bits_sent + 7) & ~7;
607#endif
608} 609}
609 610
610 611
@@ -619,13 +620,9 @@ static void copy_block(char *buf, unsigned len, int header)
619 if (header) { 620 if (header) {
620 unsigned v = ((uint16_t)len) | ((~len) << 16); 621 unsigned v = ((uint16_t)len) | ((~len) << 16);
621 put_32bit(v); 622 put_32bit(v);
622#ifdef DEBUG 623 DEBUG_bits_sent(+= 2 * 16);
623 G1.bits_sent += 2 * 16;
624#endif
625 } 624 }
626#ifdef DEBUG 625 DEBUG_bits_sent(+= (ulg) len << 3);
627 G1.bits_sent += (ulg) len << 3;
628#endif
629 while (len--) { 626 while (len--) {
630 put_8bit(*buf++); 627 put_8bit(*buf++);
631 } 628 }
@@ -1942,9 +1939,7 @@ static void bi_init(void)
1942{ 1939{
1943 //G1.bi_buf = 0; // globals are zeroed in pack_gzip() 1940 //G1.bi_buf = 0; // globals are zeroed in pack_gzip()
1944 //G1.bi_valid = 0; // globals are zeroed in pack_gzip() 1941 //G1.bi_valid = 0; // globals are zeroed in pack_gzip()
1945#ifdef DEBUG 1942 //DEBUG_bits_sent(= 0L); // globals are zeroed in pack_gzip()
1946 //G1.bits_sent = 0L; // globals are zeroed in pack_gzip()
1947#endif
1948} 1943}
1949 1944
1950 1945