|
166 | 166 | * |
167 | 167 | * Copyright (c) 1999-2007, PostgreSQL Global Development Group |
168 | 168 | * |
169 | | - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.26 2007/04/06 04:21:43 tgl Exp $ |
| 169 | + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.27 2007/08/04 21:53:00 tgl Exp $ |
170 | 170 | * ---------- |
171 | 171 | */ |
172 | 172 | #include "postgres.h" |
@@ -211,29 +211,27 @@ typedef struct PGLZ_HistEntry |
211 | 211 | * ---------- |
212 | 212 | */ |
213 | 213 | static const PGLZ_Strategy strategy_default_data = { |
214 | | - 256, /* Data chunks smaller 256 bytes are not |
215 | | - * compressed */ |
216 | | - 6144, /* Data chunks greater equal 6K force |
217 | | - * compression */ |
218 | | - /* except compressed result is greater uncompressed data */ |
219 | | - 20, /* Compression rates below 20% mean fallback |
220 | | - * to uncompressed */ |
221 | | - /* storage except compression is forced by previous parameter */ |
| 214 | + 256, /* Data chunks less than 256 bytes are not |
| 215 | + * compressed */ |
| 216 | + 6144, /* Data chunks >= 6K force compression, unless |
| 217 | + * compressed output is larger than input */ |
| 218 | + 20, /* Below 6K, compression rates below 20% mean |
| 219 | + * fallback to uncompressed */ |
222 | 220 | 128, /* Stop history lookup if a match of 128 bytes |
223 | | - * is found */ |
| 221 | + * is found */ |
224 | 222 | 10 /* Lower good match size by 10% at every |
225 | | - * lookup loop iteration. */ |
| 223 | + * lookup loop iteration */ |
226 | 224 | }; |
227 | 225 | const PGLZ_Strategy * const PGLZ_strategy_default = &strategy_default_data; |
228 | 226 |
|
229 | 227 |
|
230 | 228 | static const PGLZ_Strategy strategy_always_data = { |
231 | | - 0, /* Chunks of any size are compressed */ |
232 | | - 0, /* */ |
233 | | - 0, /* We want to save at least one single byte */ |
| 229 | + 0, /* Chunks of any size are compressed */ |
| 230 | + 0, |
| 231 | + 0, /* It's enough to save one single byte */ |
234 | 232 | 128, /* Stop history lookup if a match of 128 bytes |
235 | | - * is found */ |
236 | | - 6 /* Look harder for a good match. */ |
| 233 | + * is found */ |
| 234 | + 6 /* Look harder for a good match */ |
237 | 235 | }; |
238 | 236 | const PGLZ_Strategy * const PGLZ_strategy_always = &strategy_always_data; |
239 | 237 |
|
@@ -511,7 +509,7 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, |
511 | 509 | * If the strategy forbids compression (at all or if source chunk too |
512 | 510 | * small), fail. |
513 | 511 | */ |
514 | | - if (strategy->match_size_good == 0 || |
| 512 | + if (strategy->match_size_good <= 0 || |
515 | 513 | slen < strategy->min_input_size) |
516 | 514 | return false; |
517 | 515 |
|
|
0 commit comments