]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Minor comments/whitespace cleanup
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 29 Aug 2020 11:48:23 +0000 (13:48 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 31 Aug 2020 11:22:54 +0000 (13:22 +0200)
deflate.h
match_tpl.h
trees.c

index 633ce25557e4d1f801c25f47d22b96e414395773..b42dc28d29c91871e7d31b1da843199b0b509076 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -176,15 +176,13 @@ typedef struct internal_state {
      */
 
     unsigned int max_chain_length;
-    /* To speed up deflation, hash chains are never searched beyond this
-     * length.  A higher limit improves compression ratio but degrades the
-     * speed.
+    /* To speed up deflation, hash chains are never searched beyond this length.
+     * A higher limit improves compression ratio but degrades the speed.
      */
 
     unsigned int max_lazy_match;
-    /* Attempt to find a better match only when the current match is strictly
-     * smaller than this value. This mechanism is used only for compression
-     * levels >= 4.
+    /* Attempt to find a better match only when the current match is strictly smaller
+     * than this value. This mechanism is used only for compression levels >= 4.
      */
 #   define max_insert_length  max_lazy_match
     /* Insert new strings in the hash table only if the match length is not
@@ -263,13 +261,10 @@ typedef struct internal_state {
 #endif
 
     uint64_t bi_buf;
-    /* Output buffer. bits are inserted starting at the bottom (least
-     * significant bits).
-     */
+    /* Output buffer. bits are inserted starting at the bottom (least significant bits). */
+
     int32_t bi_valid;
-    /* Number of valid bits in bi_buf.  All bits above the last valid bit
-     * are always zero.
-     */
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit are always zero. */
 
 } deflate_state;
 
index 12da39f449d3280b9c8f34e056fb2bec09f9b92f..823532cd2b9af19a254e49473238fb8429db75e8 100644 (file)
@@ -20,8 +20,7 @@ typedef uint8_t         bestcmp_t;
 
 #endif
 
-/*
- * Set match_start to the longest match starting at the given string and
+/* Set match_start to the longest match starting at the given string and
  * return its length. Matches shorter or equal to prev_length are discarded,
  * in which case the result is equal to prev_length and match_start is garbage.
  *
@@ -52,15 +51,12 @@ Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
         continue; \
     return best_len;
 
-    /*
-     * The code is optimized for MAX_MATCH-2 multiple of 16.
-     */
+    /* The code is optimized for MAX_MATCH-2 multiple of 16. */
     Assert(MAX_MATCH == 258, "Code too clever");
 
     best_len = s->prev_length ? s->prev_length : 1;
 
-    /* 
-     * Calculate read offset which should only extend an extra byte 
+    /* Calculate read offset which should only extend an extra byte
      * to find the next best match length.
      */
     offset = best_len-1;
@@ -82,16 +78,13 @@ Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
 #endif
     mbase_end  = (mbase_start+offset);
 
-    /*
-     * Do not waste too much time if we already have a good match
-     */
+    /* Do not waste too much time if we already have a good match */
     chain_length = s->max_chain_length;
     if (best_len >= s->good_match)
         chain_length >>= 2;
     nice_match = (uint32_t)s->nice_match;
 
-    /*
-     * Stop when cur_match becomes <= limit. To simplify the code,
+    /* Stop when cur_match becomes <= limit. To simplify the code,
      * we prevent matches with the string of window index 0
      */
     limit = strstart > MAX_DIST(s) ? (Pos)(strstart - MAX_DIST(s)) : 0;
@@ -102,15 +95,12 @@ Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
         if (cur_match >= strstart)
             break;
 
-        /*
-         * Skip to next match if the match length cannot increase
-         * or if the match length is less than 2. Note that the checks
-         * below for insufficient lookahead only occur occasionally
-         * for performance reasons. Therefore uninitialized memory
-         * will be accessed and conditional jumps will be made that
-         * depend on those values. However the length of the match
-         * is limited to the lookahead, so the output of deflate is not
-         * affected by the uninitialized values.
+        /* Skip to next match if the match length cannot increase or if the match length is
+         * less than 2. Note that the checks below for insufficient lookahead only occur
+         * occasionally for performance reasons.
+         * Therefore uninitialized memory will be accessed and conditional jumps will be made
+         * that depend on those values. However the length of the match is limited to the
+         * lookahead, so the output of deflate is not affected by the uninitialized values.
          */
 #ifdef UNALIGNED_OK
         if (best_len < sizeof(uint32_t)) {
@@ -173,10 +163,8 @@ Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
 #endif
             mbase_end = (mbase_start+offset);
         } else {
-            /*
-             * The probability of finding a match later if we here
-             * is pretty low, so for performance it's best to
-             * outright stop here for the lower compression levels
+            /* The probability of finding a match later if we here is pretty low, so for
+             * performance it's best to outright stop here for the lower compression levels
              */
             if (s->level < EARLY_EXIT_TRIGGER_LEVEL)
                 break;
diff --git a/trees.c b/trees.c
index 6a4362b04a497079d4bc829da2a933ce6ccf7aac..2d1cccbb439c94dc5864b1cc68e5e0d65a54ee6f 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -333,7 +333,8 @@ static void build_tree(deflate_state *s, tree_desc *desc) {
      * 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) {