diff --git a/Include/Fledasty/Core/Queue.h b/Include/Fledasty/Core/Queue.h index ab9f472..0821a74 100644 --- a/Include/Fledasty/Core/Queue.h +++ b/Include/Fledasty/Core/Queue.h @@ -40,11 +40,11 @@ FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, void *values, FledastyError fledasty_queue_destroy(FledastyQueue *current_queue); FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value); -void *fledasty_queue_peek(const FledastyQueue *current_queue); void *fledasty_queue_pop(FledastyQueue *current_queue); FledastyError fledasty_queue_clear(FledastyQueue *current_queue); +static inline void *fledasty_queue_peek(const FledastyQueue *current_queue) { return (current_queue == NULL) ? NULL : current_queue->buffer + (current_queue->head * current_queue->element_byte_size); } static inline bool fledasty_queue_is_empty(const FledastyQueue *current_queue) { return current_queue == NULL || current_queue->size == 0; } #endif diff --git a/Src/Core/Queue.c b/Src/Core/Queue.c index 1fc4686..f0e55fc 100644 --- a/Src/Core/Queue.c +++ b/Src/Core/Queue.c @@ -54,7 +54,6 @@ FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, void *values, } new_queue->tail = new_queue->size; - return FLEDASTY_ERROR_NONE; } @@ -102,14 +101,6 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) { return FLEDASTY_ERROR_NONE; } -void *fledasty_queue_peek(const FledastyQueue *current_queue) { - if (current_queue == NULL) { - return NULL; - } - - return current_queue->buffer + (current_queue->head * current_queue->element_byte_size); -} - void *fledasty_queue_pop(FledastyQueue *current_queue) { if (current_queue == NULL || current_queue->size == 0) { return NULL;