[or-cvs] Use bitwise masking to turn off bits, not compare-and-subtr...

Nick Mathewson nickm at seul.org
Wed Oct 20 23:15:52 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv8381/src/or

Modified Files:
	main.c 
Log Message:
Use bitwise masking to turn off bits, not compare-and-subtract

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -d -r1.336 -r1.337
--- main.c	17 Oct 2004 21:51:20 -0000	1.336
+++ main.c	20 Oct 2004 23:15:49 -0000	1.337
@@ -191,8 +191,7 @@
   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 @@
   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. */



More information about the tor-commits mailing list