- /* use right child if it exists and is smaller */
- if (child+1 < heap->data_used) {
- res = heap->comparator(heap->data[(child+1)*2], heap->data[child*2]);
- if (res < 0) child = child+1;
- }
- res = heap->comparator(last_key, heap->data[child*2]);
- if (res <= 0) break;
- heap->data[pos*2] = heap->data[child*2];
- heap->data[pos*2+1] = heap->data[child*2+1];
- pos = child;
+ /* use right child if it exists and is smaller */
+ if (child+1 < heap->data_used) {
+ res = heap->comparator(heap->data[(child+1)*2], heap->data[child*2]);
+ if (res < 0) child = child+1;
+ }
+ res = heap->comparator(last_key, heap->data[child*2]);
+ if (res <= 0) break;
+ heap->data[pos*2] = heap->data[child*2];
+ heap->data[pos*2+1] = heap->data[child*2+1];
+ pos = child;