]> granicus.if.org Git - libevent/commitdiff
Remove a needless min_heap_shift_up_() call
authorNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 17:46:29 +0000 (13:46 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 17:46:29 +0000 (13:46 -0400)
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

index a240bf3a309ce7aea6b03394b134be794e07eb9a..f877e55eb7d2431e84be70c5bb402291acb08757 100644 (file)
@@ -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_ */