]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use bitwise masking to turn off bits, not compare-and-subtract
authorNick Mathewson <nickm@torproject.org>
Wed, 20 Oct 2004 23:15:49 +0000 (23:15 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 20 Oct 2004 23:15:49 +0000 (23:15 +0000)
svn:r2572

src/or/main.c

index b0bb65a343a846f65a938363a9e1f87c764e3863..165f9c8b52087d2cb3484d68612a7898cc3f2f28 100644 (file)
@@ -191,8 +191,7 @@ void connection_stop_reading(connection_t *conn) {
   tor_assert(conn->poll_index < nfds);
 
   log(LOG_DEBUG,"connection_stop_reading() called.");
-  if(poll_array[conn->poll_index].events & POLLIN)
-    poll_array[conn->poll_index].events -= POLLIN;
+  poll_array[conn->poll_index].events &= ~POLLIN;
 }
 
 /** Tell the main loop to start notifying <b>conn</b> of any read events. */
@@ -213,8 +212,7 @@ void connection_stop_writing(connection_t *conn) {
   tor_assert(conn);
   tor_assert(conn->poll_index >= 0);
   tor_assert(conn->poll_index < nfds);
-  if(poll_array[conn->poll_index].events & POLLOUT)
-    poll_array[conn->poll_index].events -= POLLOUT;
+  poll_array[conn->poll_index].events &= ~POLLOUT;
 }
 
 /** Tell the main loop to start notifying <b>conn</b> of any write events. */