fix(queue): removed test code
This commit is contained in:
parent
ee75c231c7
commit
f2ab24a7c1
3 changed files with 2 additions and 4 deletions
0
Include/Fledasty/Core/Stack.h
Normal file
0
Include/Fledasty/Core/Stack.h
Normal file
|
|
@ -25,7 +25,6 @@
|
||||||
#include <Hallocy/Core/Allocator.h>
|
#include <Hallocy/Core/Allocator.h>
|
||||||
#include <Hallocy/Core/Memory.h>
|
#include <Hallocy/Core/Memory.h>
|
||||||
#include <Hallocy/Utils/Error.h>
|
#include <Hallocy/Utils/Error.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, const size_t element_byte_size) {
|
FledastyError fledasty_queue_initialize(FledastyQueue *new_queue, const size_t element_byte_size) {
|
||||||
if (new_queue == NULL) {
|
if (new_queue == NULL) {
|
||||||
|
|
@ -60,7 +59,7 @@ FledastyError fledasty_queue_destroy(FledastyQueue *current_queue) {
|
||||||
current_queue->buffer = NULL;
|
current_queue->buffer = NULL;
|
||||||
return FLEDASTY_ERROR_NONE;
|
return FLEDASTY_ERROR_NONE;
|
||||||
}
|
}
|
||||||
#include <stdio.h>
|
|
||||||
FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) {
|
FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) {
|
||||||
if (current_queue == NULL || value == NULL) {
|
if (current_queue == NULL || value == NULL) {
|
||||||
return FLEDASTY_ERROR_INVALID_POINTER;
|
return FLEDASTY_ERROR_INVALID_POINTER;
|
||||||
|
|
@ -73,7 +72,7 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) {
|
||||||
if (current_queue->buffer == NULL) {
|
if (current_queue->buffer == NULL) {
|
||||||
return FLEDASTY_ERROR_FAILED_ALLOCATION;
|
return FLEDASTY_ERROR_FAILED_ALLOCATION;
|
||||||
}
|
}
|
||||||
printf("Allocated\n");
|
|
||||||
size_t new_head = current_queue->capacity - current_queue->head;
|
size_t new_head = current_queue->capacity - current_queue->head;
|
||||||
hallocy_move_memory(current_queue->buffer + (current_queue->head * current_queue->element_byte_size), current_queue->buffer + (new_head * current_queue->element_byte_size), current_queue->size - current_queue->tail);
|
hallocy_move_memory(current_queue->buffer + (current_queue->head * current_queue->element_byte_size), current_queue->buffer + (new_head * current_queue->element_byte_size), current_queue->size - current_queue->tail);
|
||||||
current_queue->head = new_head;
|
current_queue->head = new_head;
|
||||||
|
|
@ -84,7 +83,6 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value) {
|
||||||
current_queue->size += 1;
|
current_queue->size += 1;
|
||||||
current_queue->tail += 1;
|
current_queue->tail += 1;
|
||||||
if (current_queue->tail >= current_queue->capacity) {
|
if (current_queue->tail >= current_queue->capacity) {
|
||||||
printf("To 0\n");
|
|
||||||
current_queue->tail = 0;
|
current_queue->tail = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
0
Src/Core/Stack.c
Normal file
0
Src/Core/Stack.c
Normal file
Loading…
Add table
Reference in a new issue