summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-05-03 03:25:04 +0000
committerNick Mathewson <nickm@torproject.org>2005-05-03 03:25:04 +0000
commit8b9ae2522409f09584d60619fc39b421560a715e (patch)
tree355362f22e18841334d1a2e75fcd32349d60843f
parent86e73d7005d6217d5a2eb4e656e81c54182b019d (diff)
downloadtor-8b9ae2522409f09584d60619fc39b421560a715e.tar.gz
tor-8b9ae2522409f09584d60619fc39b421560a715e.zip
Change some >=s to >s in buf_resize, so that we do not denormalize buffers on resize.
svn:r4172
-rw-r--r--src/or/buffers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 94de0b284a..6135923f09 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -138,9 +138,9 @@ static void buf_resize(buf_t *buf, size_t new_capacity)
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 @@ static void buf_resize(buf_t *buf, size_t new_capacity)
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:
*