[or-cvs] Turn a while into a do/while; save a redundant test

Nick Mathewson nickm at seul.org
Sat Jun 24 02:10:23 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv31573/src/or

Modified Files:
	buffers.c 
Log Message:
Turn a while into a do/while; save a redundant test

Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/buffers.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -p -d -r1.199 -r1.200
--- buffers.c	18 Jun 2006 20:39:46 -0000	1.199
+++ buffers.c	24 Jun 2006 02:10:21 -0000	1.200
@@ -1299,7 +1299,7 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_s
   char *next;
   size_t old_avail, avail;
   int over = 0;
-  while (!over) {
+  do {
     buf_ensure_capacity(buf, buf->datalen + 1024);
     next = _buf_end(buf);
     if (next < buf->cur)
@@ -1339,7 +1339,7 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_s
     if (buf->datalen > buf->highwater)
       buf->highwater = buf->datalen;
     buf_total_used += old_avail - avail;
-  }
+  } while (!over);
   return 0;
 }
 



More information about the tor-commits mailing list