This could only matter if (a) long is wider than int, and (b) the heap
of free blocks exceeds UINT_MAX entries, which seems pretty unlikely.
Still, it's a theoretical bug, so backpatch to v13 where the typo came
in (in commit
c02fdc922).
In passing, also make swap_nodes() use consistent datatypes.
Ma Liangzhu
Discussion: https://postgr.es/m/17336-
fc4e522d26a750fd@postgresql.org
static inline void
swap_nodes(long *heap, unsigned long a, unsigned long b)
{
- unsigned long swap;
+ long swap;
swap = heap[a];
heap[a] = heap[b];
}
static inline unsigned long
-right_offset(unsigned i)
+right_offset(unsigned long i)
{
return 2 * i + 2;
}