From: Nick Mathewson Date: Fri, 26 Mar 2010 17:46:29 +0000 (-0400) Subject: Remove a needless min_heap_shift_up_() call X-Git-Tag: release-2.0.5-beta~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7204b916669f9b9ff0dae689088a5ab0344edebd;p=libevent 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. --- 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_ */