diff options
-rw-r--r-- | collections/double_ended_queue.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/collections/double_ended_queue.c b/collections/double_ended_queue.c index f8f59e4..e737d28 100644 --- a/collections/double_ended_queue.c +++ b/collections/double_ended_queue.c @@ -107,15 +107,10 @@ int index; { void **tmp; - if (!root || index > root->limit - || (index >= root->end && index < root->beg)) - return NULL; - - index = (root->beg + index) % root->limit; - if (index >= root->end) + if (!root || !DEQ_IN_BOUNDS(root,index)) return NULL; - return root->base[index]; + return root->base[(root->beg + index) % root->limit]; } void deq_push_back(root, item) |