Fix logic error relating to the initial call to QueuePush()

This commit is contained in:
Jordan Bancino 2022-08-24 14:41:42 -04:00
parent 665da9d33e
commit 55a49e418f

View file

@ -115,7 +115,15 @@ QueuePush(Queue * q, void *element)
q->front = 0;
}
q->rear = (q->rear + 1) % q->size;
if (q->rear == q->size + 1)
{
q->rear = 0;
}
else
{
q->rear = (q->rear + 1) % q->size;
}
q->items[q->rear] = element;
return 1;