aboutsummaryrefslogtreecommitdiff
path: root/src/rt
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-01-07 21:29:32 -0500
committerGraydon Hoare <[email protected]>2011-01-10 11:31:32 -0800
commit04056d89c831767f3c71a0cc274e7c17b5721734 (patch)
tree1b82e86ead3fa0089c2e17729390beb133435262 /src/rt
parentSimplify the test for circular_buffer initialization (diff)
downloadrust-04056d89c831767f3c71a0cc274e7c17b5721734.tar.xz
rust-04056d89c831767f3c71a0cc274e7c17b5721734.zip
Fix the check for growing the circular_buffer
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/circular_buffer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rt/circular_buffer.cpp b/src/rt/circular_buffer.cpp
index bdf25124..77509abb 100644
--- a/src/rt/circular_buffer.cpp
+++ b/src/rt/circular_buffer.cpp
@@ -62,7 +62,7 @@ circular_buffer::enqueue(void *src) {
I(dom, _unread <= _buffer_sz);
// Grow if necessary.
- if (_unread == _buffer_sz) {
+ if (_unread + unit_sz > _buffer_sz) {
size_t new_buffer_sz = _buffer_sz << 1;
I(dom, new_buffer_sz <= MAX_CIRCULAR_BUFFFER_SIZE);
void *new_buffer = dom->malloc(new_buffer_sz);