summaryrefslogtreecommitdiffstats
path: root/stdlib/queue.ml
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/queue.ml')
-rw-r--r--stdlib/queue.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/stdlib/queue.ml b/stdlib/queue.ml
index 4e12eb3d2..388a46c53 100644
--- a/stdlib/queue.ml
+++ b/stdlib/queue.ml
@@ -54,12 +54,12 @@ let clear q =
q.tail <- Obj.magic None
let add x q =
- q.length <- q.length + 1;
- if q.length = 1 then
+ if q.length = 0 then
let rec cell = {
content = x;
next = cell
} in
+ q.length <- 1;
q.tail <- cell
else
let tail = q.tail in
@@ -68,6 +68,7 @@ let add x q =
content = x;
next = head
} in
+ q.length <- q.length + 1;
tail.next <- cell;
q.tail <- cell