From 7204b916669f9b9ff0dae689088a5ab0344edebd Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 26 Mar 2010 13:46:29 -0400 Subject: [PATCH] Remove a needless min_heap_shift_up_() call Previously, every call to min_heap_shift_down_() would invoke min_heap_shift_up_() at the end. This used to be necessary in the first version of the minheap code, since min_heap_erase() would call min_heap_shift_down_() unconditionally. But when patch 8b7a3b36763 from Marko Kreen fixed min_heap_erase() to be more sensible, we left the weird behavior of min_heap_shift_down_() in place. Fortunately, "cui" noticed this and reported it on Niels's blog. --- minheap-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minheap-internal.h b/minheap-internal.h index a240bf3a..f877e55e 100644 --- a/minheap-internal.h +++ b/minheap-internal.h @@ -153,7 +153,7 @@ void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e) hole_index = min_child; min_child = 2 * (hole_index + 1); } - min_heap_shift_up_(s, hole_index, e); + (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; } #endif /* _MIN_HEAP_H_ */ -- 2.40.0