some fixes
This commit is contained in:
@@ -158,8 +158,8 @@ char* __cptr_concat(allocator_ptr al, u32 n, ...){
|
||||
totality+=lengths[k];
|
||||
}
|
||||
|
||||
free(strs);
|
||||
free(lengths);
|
||||
allocator_free(al, lengths);
|
||||
allocator_free(al, strs);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ void StackingAllocator_free(allocator_ptr _self, void* data_ptr){
|
||||
assert(data_ptr!=NULL);
|
||||
StackingAllocator* self = (StackingAllocator*)_self;
|
||||
AllocationHeader* header_ptr = data_ptr - sizeof(AllocationHeader);
|
||||
|
||||
// TODO check is data_ptr pointer to the last allocation
|
||||
// chunk is empty
|
||||
if(curr_chunk->occupied_size==0){
|
||||
// isn't the first chunk
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
tni=1; \
|
||||
} else tni=2; \
|
||||
kprintf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%f \e[93m%s\n", \
|
||||
opname, t, tnames[tni]);
|
||||
opname, t, tnames[tni]); \
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CLOCK_REALTIME
|
||||
/// executes codeblock and prints execution time
|
||||
|
||||
@@ -91,7 +91,7 @@ char *Unitype_toString(allocator_ptr al, Unitype u, u32 fmt)
|
||||
void printuni(Unitype v)
|
||||
{
|
||||
LinearAllocator _al;
|
||||
LinearAllocator_construct(&_al, 256);
|
||||
LinearAllocator_construct(&_al, 128);
|
||||
allocator_ptr al=&_al.base;
|
||||
char *s = Unitype_toString(al, v, 0);
|
||||
fputs(s, stdout);
|
||||
|
||||
@@ -83,7 +83,6 @@ void __kprint(u8 n, kp_fmt* formats, __kp_value_union* objects){
|
||||
kp_fmt fmt=formats[i];
|
||||
kprint_setColor(fmt);
|
||||
tryLast(__next_toString(al, fmt, &objects[i]), maybeStr,
|
||||
LinearAllocator_destruct(&_al);
|
||||
kprint_setColor(kp_bgBlack|kp_fgGray););
|
||||
if(fputs(maybeStr.value.VoidPtr, stdout)==EOF)
|
||||
throw("can't write string to stdout");
|
||||
|
||||
@@ -50,7 +50,7 @@ void kprintf(const char* format, ...){
|
||||
va_start(vl, format);
|
||||
u32 i=0;
|
||||
LinearAllocator _al;
|
||||
LinearAllocator_construct(&_al, 256);
|
||||
LinearAllocator_construct(&_al, 128);
|
||||
allocator_ptr al=(allocator_ptr)&_al;
|
||||
for(char c=format[i++]; c!=0; c=format[i++]){
|
||||
// value format specifiers
|
||||
|
||||
Reference in New Issue
Block a user