f3-basic-hash-tabel #21
3 changed files with 12 additions and 0 deletions
|
|
@ -43,6 +43,8 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value);
|
||||||
void *fledasty_queue_peek(const FledastyQueue *current_queue);
|
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);
|
||||||
|
|
||||||
static inline bool fledasty_queue_is_empty(const FledastyQueue *current_queue) { return current_queue->size == 0; }
|
static inline bool fledasty_queue_is_empty(const FledastyQueue *current_queue) { return current_queue->size == 0; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -125,3 +125,12 @@ void *fledasty_queue_pop(FledastyQueue *current_queue) {
|
||||||
|
|
||||||
return value_address;
|
return value_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FledastyError fledasty_queue_clear(FledastyQueue *current_queue) {
|
||||||
|
if (current_queue == NULL) {
|
||||||
|
return FLEDASTY_ERROR_INVALID_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_queue->size = 0;
|
||||||
|
return FLEDASTY_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ int main() {
|
||||||
printf("Queue popped: %d\n", *popped_data);
|
printf("Queue popped: %d\n", *popped_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fledasty_queue_clear(&test_queue);
|
||||||
if (fledasty_queue_is_empty(&test_queue)) {
|
if (fledasty_queue_is_empty(&test_queue)) {
|
||||||
printf("Queue is empty\n");
|
printf("Queue is empty\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue