From cb927a51731188a4135906b6d7518c04ce12b05e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 19 Jul 2010 15:03:43 +0200 Subject: [PATCH] Fix whitespace. --- evmap.c | 8 ++++---- test/test-changelist.c | 13 ++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/evmap.c b/evmap.c index 904eefdf..9d21977d 100644 --- a/evmap.c +++ b/evmap.c @@ -691,7 +691,7 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho As well as checking the current operation we should also check the original set of events to make sure were not ignoring - the case where the add operation is present on an event that + the case where the add operation is present on an event that was already set. If we have a no-op item, we could remove it it from the list @@ -699,19 +699,19 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho change when we do the dispatch later is far cheaper than rejuggling the array now. - As this stands, it also lets through deletions of events that are + As this stands, it also lets through deletions of events that are not currently set. */ if (events & (EV_READ|EV_SIGNAL)) { - if (!(change->old_events & (EV_READ | EV_SIGNAL)) && + if (!(change->old_events & (EV_READ | EV_SIGNAL)) && (change->read_change & EV_CHANGE_ADD)) change->read_change = 0; else change->read_change = EV_CHANGE_DEL; } if (events & EV_WRITE) { - if (!(change->old_events & EV_WRITE) && + if (!(change->old_events & EV_WRITE) && (change->write_change & EV_CHANGE_ADD)) change->write_change = 0; else diff --git a/test/test-changelist.c b/test/test-changelist.c index 5fc2dc87..cdc32abd 100644 --- a/test/test-changelist.c +++ b/test/test-changelist.c @@ -15,7 +15,6 @@ #include #endif - #ifdef _EVENT_HAVE_SYS_SOCKET_H #include #endif @@ -32,9 +31,9 @@ static void write_cb(evutil_socket_t fd, short event, void *arg) -{ +{ printf("write callback. should only see this once\n"); - + /* got what we want remove the event */ event_del(*(struct event**)arg); @@ -48,7 +47,7 @@ write_cb(evutil_socket_t fd, short event, void *arg) static void timeout_cb(evutil_socket_t fd, short event, void *arg) -{ +{ printf("timeout fired, time to end test\n"); event_del(*(struct event**)arg); return; @@ -111,17 +110,17 @@ main(int argc, char **argv) /* attempt to calculate our cpu usage over the test should be virtually nil */ - + tickspassed = ((((timeEnd.tv_sec - timeBegin.tv_sec) * 1000000.0) + (timeEnd.tv_usec - timeBegin.tv_usec)) * ((1.0 * CLOCKS_PER_SEC) / 1000000)); - + usage = 100.0 * (((int)(ticksEnd-ticksBegin) * 1.0) / tickspassed); printf("ticks used=%d, ticks passed=%d, cpu usage=%.2f%%\n", (int)(ticksEnd-ticksBegin), tickspassed, - usage); + usage); if (usage > 50.0) /* way too high */ return 1;