[or-cvs] Change some >=s to >s in buf_resize, so that we do not deno...

Nick Mathewson nickm at seul.org
Tue May 3 03:25:06 UTC 2005


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

Modified Files:
	buffers.c 
Log Message:
Change some >=s to >s in buf_resize, so that we do not denormalize buffers on resize.

Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/buffers.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- buffers.c	2 May 2005 23:41:39 -0000	1.150
+++ buffers.c	3 May 2005 03:25:04 -0000	1.151
@@ -138,9 +138,9 @@
     return;
 
   offset = buf->cur - buf->mem;
-  if (offset + buf->datalen >= new_capacity) {
+  if (offset + buf->datalen > new_capacity) {
     /* We need to move stuff before we shrink. */
-    if (offset+buf->datalen >= buf->len) {
+    if (offset + buf->datalen > buf->len) {
       /* We have:
        *
        * mem[0] ... mem[datalen-(len-offset)] (end of data)
@@ -165,7 +165,7 @@
                                      ALLOC_LEN(new_capacity)));
   SET_GUARDS(buf->mem, new_capacity);
   buf->cur = buf->mem+offset;
-  if (offset + buf->datalen >= buf->len) {
+  if (offset + buf->datalen > buf->len) {
     /* We need to move data now that we are done growing.  The buffer
      * now contains:
      *



More information about the tor-commits mailing list