From 8d30337566a94b5b66b00d1cdff01ec1203a53a2 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sat, 4 Aug 2007 21:53:00 +0000
Subject: [PATCH] Fix up bad layout of some comments (probably pg_indent's
 fault), and improve grammar a tad.  Per Greg Stark.

---
 src/backend/utils/adt/pg_lzcompress.c | 32 +++++++++++++--------------
 src/include/utils/pg_lzcompress.h     | 20 +++++++++--------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c
index 085bc63e0dd..f843232ba64 100644
--- a/src/backend/utils/adt/pg_lzcompress.c
+++ b/src/backend/utils/adt/pg_lzcompress.c
@@ -166,7 +166,7 @@
  *
  * Copyright (c) 1999-2007, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.26 2007/04/06 04:21:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.27 2007/08/04 21:53:00 tgl Exp $
  * ----------
  */
 #include "postgres.h"
@@ -211,29 +211,27 @@ typedef struct PGLZ_HistEntry
  * ----------
  */
 static const PGLZ_Strategy strategy_default_data = {
-	256,						/* Data chunks smaller 256 bytes are not
-								 * compressed			 */
-	6144,						/* Data chunks greater equal 6K force
-								 * compression				 */
-	/* except compressed result is greater uncompressed data		*/
-	20,							/* Compression rates below 20% mean fallback
-								 * to uncompressed	  */
-	/* storage except compression is forced by previous parameter	*/
+	256,						/* Data chunks less than 256 bytes are not
+								 * compressed */
+	6144,						/* Data chunks >= 6K force compression, unless
+								 * compressed output is larger than input */
+	20,							/* Below 6K, compression rates below 20% mean
+								 * fallback to uncompressed */
 	128,						/* Stop history lookup if a match of 128 bytes
-								 * is found			*/
+								 * is found */
 	10							/* Lower good match size by 10% at every
-								 * lookup loop iteration. */
+								 * lookup loop iteration */
 };
 const PGLZ_Strategy * const PGLZ_strategy_default = &strategy_default_data;
 
 
 static const PGLZ_Strategy strategy_always_data = {
-	0,							/* Chunks of any size are compressed							*/
-	0,							/* */
-	0,							/* We want to save at least one single byte						*/
+	0,							/* Chunks of any size are compressed */
+	0,
+	0,							/* It's enough to save one single byte */
 	128,						/* Stop history lookup if a match of 128 bytes
-								 * is found			*/
-	6							/* Look harder for a good match.								*/
+								 * is found */
+	6							/* Look harder for a good match */
 };
 const PGLZ_Strategy * const PGLZ_strategy_always = &strategy_always_data;
 
@@ -511,7 +509,7 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest,
 	 * If the strategy forbids compression (at all or if source chunk too
 	 * small), fail.
 	 */
-	if (strategy->match_size_good == 0 ||
+	if (strategy->match_size_good <= 0 ||
 		slen < strategy->min_input_size)
 		return false;
 
diff --git a/src/include/utils/pg_lzcompress.h b/src/include/utils/pg_lzcompress.h
index bed75d9af17..fdd9701ee0e 100644
--- a/src/include/utils/pg_lzcompress.h
+++ b/src/include/utils/pg_lzcompress.h
@@ -3,7 +3,7 @@
  *
  *	Definitions for the builtin LZ compressor
  *
- * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.14 2007/02/27 23:48:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.15 2007/08/04 21:53:00 tgl Exp $
  * ----------
  */
 
@@ -50,16 +50,18 @@ typedef struct PGLZ_Header
  *
  *		min_input_size		Minimum input data size to start compression.
  *
- *		force_input_size	Input data size at which compressed storage is
- *							forced even if the compression rate drops below
- *							min_comp_rate (but not below 0).
- *
- *		min_comp_rate		Minimum compression rate (0-99%), the output
- *							must be smaller than the input. If that isn't
+ *		force_input_size	Minimum input data size to force compression
+ *							even if the compression rate drops below
+ *							min_comp_rate.  But in any case the output
+ *							must be smaller than the input.  If that isn't
  *							the case, the compressor will throw away its
  *							output and copy the original, uncompressed data
  *							to the output buffer.
  *
+ *		min_comp_rate		Minimum compression rate (0-99%) to require for
+ *							inputs smaller than force_input_size.  If not
+ *							achieved, the output will be uncompressed.
+ *
  *		match_size_good		The initial GOOD match size when starting history
  *							lookup. When looking up the history to find a
  *							match that could be expressed as a tag, the
@@ -70,8 +72,8 @@ typedef struct PGLZ_Header
  *							longer the lookup takes, the smaller matches
  *							are considered good.
  *
- *		match_size_drop		The percentage, match_size_good is lowered
- *							at each history check. Allowed values are
+ *		match_size_drop		The percentage by which match_size_good is lowered
+ *							after each history check. Allowed values are
  *							0 (no change until end) to 100 (only check
  *							latest history entry at all).
  * ----------
-- 
GitLab