Compare commits
No commits in common. "349268068bc0162bd8067ee14df69829fcc6a521" and "f7ac0e519257c5484ac7eba9a9d606818cdca769" have entirely different histories.
349268068b
...
f7ac0e5192
4 changed files with 19 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ FledastyError fledasty_stack_initialize(FledastyStack *new_stack, void *values,
|
|||
FledastyError fledasty_stack_destroy(FledastyStack *current_stack);
|
||||
|
||||
FledastyError fledasty_stack_push(FledastyStack *current_stack, void *value);
|
||||
void *fledasty_stack_peek(const FledastyStack *current_stack);
|
||||
void *fledasty_stack_pop(FledastyStack *current_stack);
|
||||
|
||||
FledastyError fledasty_stack_clear(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; }
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, void *values,
|
|||
}
|
||||
|
||||
new_queue->tail = new_queue->size;
|
||||
|
||||
return FLEDASTY_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +102,14 @@ 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;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,14 @@ FledastyError fledasty_stack_push(FledastyStack *current_stack, void *value) {
|
|||
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) {
|
||||
if (current_stack == NULL) {
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue