Speed up invoke_callbacks on evbuffers when there are no callbacks

This fixes a performance regression against 1.4
This commit is contained in:
Mark Ellzey 2011-07-04 11:47:24 -04:00 committed by Nick Mathewson
parent e050703d47
commit f87f56894d

View File

@ -447,6 +447,11 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
static inline void
evbuffer_invoke_callbacks(struct evbuffer *buffer)
{
if (TAILQ_EMPTY(&buffer->callbacks)) {
buffer->n_add_for_cb = buffer->n_del_for_cb = 0;
return;
}
if (buffer->deferred_cbs) {
if (buffer->deferred.queued)
return;