Compare commits

..

2 commits

4 changed files with 2 additions and 19 deletions

View file

@ -40,11 +40,11 @@ FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, void *values,
FledastyError fledasty_queue_destroy(FledastyQueue *current_queue); FledastyError fledasty_queue_destroy(FledastyQueue *current_queue);
FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value); FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value);
void *fledasty_queue_peek(const FledastyQueue *current_queue);
void *fledasty_queue_pop(FledastyQueue *current_queue); void *fledasty_queue_pop(FledastyQueue *current_queue);
FledastyError fledasty_queue_clear(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; } static inline bool fledasty_queue_is_empty(const FledastyQueue *current_queue) { return current_queue == NULL || current_queue->size == 0; }
#endif #endif

View file

@ -39,12 +39,12 @@ FledastyError fledasty_stack_initialize(FledastyStack *new_stack, void *values,
FledastyError fledasty_stack_destroy(FledastyStack *current_stack); FledastyError fledasty_stack_destroy(FledastyStack *current_stack);
FledastyError fledasty_stack_push(FledastyStack *current_stack, void *value); FledastyError fledasty_stack_push(FledastyStack *current_stack, void *value);
void *fledasty_stack_peek(const FledastyStack *current_stack);
void *fledasty_stack_pop(FledastyStack *current_stack); void *fledasty_stack_pop(FledastyStack *current_stack);
FledastyError fledasty_stack_clear(FledastyStack *current_stack); FledastyError fledasty_stack_clear(FledastyStack *current_stack);
FledastyError fledasty_stack_shrink_to_fit(FledastyStack *current_stack); FledastyError fledasty_stack_shrink_to_fit(FledastyStack *current_stack);
static inline void *fledasty_stack_peek(const FledastyStack *current_stack) { (current_stack == NULL) ? NULL : current_stack->buffer + ((current_stack->size - 1) * current_stack->element_byte_size); }
static inline bool fledasty_stack_is_empty(const FledastyStack *current_stack) { return current_stack == NULL || current_stack->size == 0; } static inline bool fledasty_stack_is_empty(const FledastyStack *current_stack) { return current_stack == NULL || current_stack->size == 0; }
#endif #endif

View file

@ -54,7 +54,6 @@ FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, void *values,
} }
new_queue->tail = new_queue->size; new_queue->tail = new_queue->size;
return FLEDASTY_ERROR_NONE; return FLEDASTY_ERROR_NONE;
} }
@ -102,14 +101,6 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) {
return FLEDASTY_ERROR_NONE; 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) { void *fledasty_queue_pop(FledastyQueue *current_queue) {
if (current_queue == NULL || current_queue->size == 0) { if (current_queue == NULL || current_queue->size == 0) {
return NULL; return NULL;

View file

@ -90,14 +90,6 @@ FledastyError fledasty_stack_push(FledastyStack *current_stack, void *value) {
return FLEDASTY_ERROR_NONE; return FLEDASTY_ERROR_NONE;
} }
void *fledasty_stack_peek(const FledastyStack *current_stack) {
if (current_stack == NULL) {
return NULL;
}
return current_stack->buffer + ((current_stack->size - 1) * current_stack->element_byte_size);
}
void *fledasty_stack_pop(FledastyStack *current_stack) { void *fledasty_stack_pop(FledastyStack *current_stack) {
if (current_stack == NULL) { if (current_stack == NULL) {
return NULL; return NULL;