mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
Fix end-of-loop optimization in pglz_find_match() function.
After the recent pglz optimization patch, the next/prev pointers in the hash table are never NULL, INVALID_ENTRY_PTR is used to represent invalid entries instead. The end-of-loop check in pglz_find_match() function didn't get the memo. The result was the same from a correctness point of view, but because the NULL-check would never fail, the tiny optimization turned into a pessimization. Reported by Stephen Frost, using Coverity scanner.
This commit is contained in:
parent
750f43685b
commit
3f2adace1e
@ -466,7 +466,7 @@ pglz_find_match(int16 *hstart, const char *input, const char *end,
|
||||
* Be happy with lesser good matches the more entries we visited. But
|
||||
* no point in doing calculation if we're at end of list.
|
||||
*/
|
||||
if (hent)
|
||||
if (hent != INVALID_ENTRY_PTR)
|
||||
{
|
||||
if (len >= good_match)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user