[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae5fc838475df9479d48302f9bbdec026274dbf6.camel@perches.com>
Date: Sat, 30 Jan 2021 11:05:24 -0800
From: Joe Perches <joe@...ches.com>
To: Jiri Kosina <trivial@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 25/29] lib/zlib: Avoid comma separated statements
On Mon, 2020-08-24 at 21:56 -0700, Joe Perches wrote:
> Use semicolons and braces.
ping?
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
> lib/zlib_deflate/deftree.c | 49 +++++++++++++++++++++++++++-----------
> 1 file changed, 35 insertions(+), 14 deletions(-)
>
> diff --git a/lib/zlib_deflate/deftree.c b/lib/zlib_deflate/deftree.c
> index a4a34da512fe..e358053bdb15 100644
> --- a/lib/zlib_deflate/deftree.c
> +++ b/lib/zlib_deflate/deftree.c
> @@ -217,10 +217,22 @@ static void tr_static_init(void)
> /* Construct the codes of the static literal tree */
> for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
> n = 0;
> - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
> - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
> - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
> - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
> + while (n <= 143) {
> + static_ltree[n++].Len = 8;
> + bl_count[8]++;
> + }
> + while (n <= 255) {
> + static_ltree[n++].Len = 9;
> + bl_count[9]++;
> + }
> + while (n <= 279) {
> + static_ltree[n++].Len = 7;
> + bl_count[7]++;
> + }
> + while (n <= 287) {
> + static_ltree[n++].Len = 8;
> + bl_count[8]++;
> + }
> /* Codes 286 and 287 do not exist, but we must include them in the
> * tree construction to get a canonical Huffman tree (longest code
> * all ones)
> @@ -378,7 +390,10 @@ static void gen_bitlen(
> for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
> n = s->heap[h];
> bits = tree[tree[n].Dad].Len + 1;
> - if (bits > max_length) bits = max_length, overflow++;
> + if (bits > max_length) {
> + bits = max_length;
> + overflow++;
> + }
> tree[n].Len = (ush)bits;
> /* We overwrite tree[n].Dad which is no longer needed */
>
>
> @@ -497,7 +512,7 @@ static void build_tree(
> * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
> * heap[0] is not used.
> */
> - s->heap_len = 0, s->heap_max = HEAP_SIZE;
> + s->heap_len = 0; s->heap_max = HEAP_SIZE;
>
>
> for (n = 0; n < elems; n++) {
> if (tree[n].Freq != 0) {
> @@ -583,7 +598,10 @@ static void scan_tree(
> int max_count = 7; /* max repeat count */
> int min_count = 4; /* min repeat count */
>
>
> - if (nextlen == 0) max_count = 138, min_count = 3;
> + if (nextlen == 0) {
> + max_count = 138;
> + min_count = 3;
> + }
> tree[max_code+1].Len = (ush)0xffff; /* guard */
>
>
> for (n = 0; n <= max_code; n++) {
> @@ -602,11 +620,11 @@ static void scan_tree(
> }
> count = 0; prevlen = curlen;
> if (nextlen == 0) {
> - max_count = 138, min_count = 3;
> + max_count = 138; min_count = 3;
> } else if (curlen == nextlen) {
> - max_count = 6, min_count = 3;
> + max_count = 6; min_count = 3;
> } else {
> - max_count = 7, min_count = 4;
> + max_count = 7; min_count = 4;
> }
> }
> }
> @@ -630,7 +648,10 @@ static void send_tree(
> int min_count = 4; /* min repeat count */
>
>
> /* tree[max_code+1].Len = -1; */ /* guard already set */
> - if (nextlen == 0) max_count = 138, min_count = 3;
> + if (nextlen == 0) {
> + max_count = 138;
> + min_count = 3;
> + }
>
>
> for (n = 0; n <= max_code; n++) {
> curlen = nextlen; nextlen = tree[n+1].Len;
> @@ -654,11 +675,11 @@ static void send_tree(
> }
> count = 0; prevlen = curlen;
> if (nextlen == 0) {
> - max_count = 138, min_count = 3;
> + max_count = 138; min_count = 3;
> } else if (curlen == nextlen) {
> - max_count = 6, min_count = 3;
> + max_count = 6; min_count = 3;
> } else {
> - max_count = 7, min_count = 4;
> + max_count = 7; min_count = 4;
> }
> }
> }
Powered by blists - more mailing lists