Commit e87a9105 authored by yb9976's avatar yb9976
Browse files

Fixed off-by-one error in pdeq_putl.

parent 486b710d
......@@ -211,7 +211,6 @@ pdeq *pdeq_putr(pdeq *dq, const void *x)
pdeq *pdeq_putl(pdeq *dq, const void *x)
{
pdeq *ldq;
size_t p;
VRFY(dq);
......@@ -237,13 +236,12 @@ pdeq *pdeq_putl(pdeq *dq, const void *x)
}
ldq->n++;
if (ldq->p == 0)
size_t p = ldq->p;
if (p == 0)
p = NDATA;
else
p = ldq->p - 1;
ldq->p = p;
ldq->data[p] = x;
ldq->data[--p] = x;
ldq->p = p;
VRFY(dq);
return dq;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment