projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No need to rebalance heap for insertion
[lttng-modules.git]
/
lib
/
prio_heap
/
prio_heap.c
diff --git
a/lib/prio_heap/prio_heap.c
b/lib/prio_heap/prio_heap.c
index c987d5de18cd10d690aa2c7152c95bc33b621dfa..29af3033812f98ba770ee28b855959b8dca82bfd 100644
(file)
--- a/
lib/prio_heap/prio_heap.c
+++ b/
lib/prio_heap/prio_heap.c
@@
-158,8
+158,11
@@
int heap_insert(struct ptr_heap *heap, void *p)
ptrs[pos] = ptrs[parent(pos)];
ptrs[parent(pos)] = tmp;
pos = parent(pos);
ptrs[pos] = ptrs[parent(pos)];
ptrs[parent(pos)] = tmp;
pos = parent(pos);
- /* rebalance */
- heapify(heap, pos);
+ /*
+ * No need to rebalance: if we are larger than
+ * our parent, we are necessarily larger than
+ * its other child.
+ */
} else {
break;
}
} else {
break;
}
This page took
0.023095 seconds
and
4
git commands to generate.