ArenaPointer now contains a reference to the original arena and an
offset instad of a raw address. Change was made to avoid invalidating
addresses and keeping a more consise system. arena_unwrap_pointer was
also included as a helper function.
OK, so evrything was a fucknig mess, it still kinda is, AI helped
me to clean my own mess, it really sucks but the fucking debugger
and address sanitizer were not working, also, there were small
small errors so no big deal but still, a bit sad, also changed a
the way i cast from uint8_t to double and int in the tests, may
change that i guess, verything else i might say is good :)
So added a little test that just adds 3 ints to an arena, nothing much
but the basics work, also changed arena_push because it only pushed and
didn't returned a ponter (wich is fucking useless) so also fixed that,
everything seems fine now, need more tests.
# Tipos:
# feat, fix, refactor, docs, style, test, chore
I wanted to separate things but i was getting confused on how exactly to do it
so i did the best i could, just multiply everithing by 2 and if it overflows then
well, return error, should be enough for most cases to be honest
I need to assure that capacity is enough, i mean, for something like
an array just doubling size is good because you are storing things
that are the same size but for something like an arena you could actually
store anything so we need to make sure the growth factor stays cool while
an overflow doesn't occur, that's why the change with arena_calculate_capacity
and also changing signatrues to use results, A LOT of boilerplate but
i guess is fine for me.
decided that arena_push will handle everything, will use alloc then push into it,
also, used realloc as a separate function for better handling resize and shit, next
is creating a save function that calculates the size needed for the element
and if it's too fucking much then throw an error. A bit overkill but yeah, i'm like
that all the time, this is suppossed to be a library to support my calculator like
damn but ok.
Added arena_alloc and decided to change the arena pointer type from void *
to uint8_t * because i need to support 1 byte pointer arithmetic, thought of
using uintptr_t but not sure, the support seems really weird from what i read
online so i'm sticking with good old uint8_t * (wich i know works).
Realized that if i want to use malloc and free i either have to make some
sort of interface that lets you use a custom allocator and deallocator
or just use them by default. Maybe later it would be cool to change it
to that but for now is out of the scope of my project.
# Tipos:
# feat, fix, refactor, docs, style, test, chore