Merge pull request #2 from OmniBlade/stdmem

Implements the stdmem.c functions.
This commit is contained in:
Jeff Harris 2019-10-30 14:38:54 -07:00 committed by GitHub
commit b22d73eeff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -2,27 +2,36 @@
// Global variables
char rscid[48];
br_allocator BrStdlibAllocator;
br_allocator *_BrDefaultAllocator;
br_allocator BrStdlibAllocator = {"malloc", BrStdlibAllocate, BrStdlibFree, BrStdlibInquire, BrStdlibAlign};
br_allocator *_BrDefaultAllocator = &BrStdlibAllocator;
// Offset: 17
// Size: 80
void* BrStdlibAllocate(br_size_t size, br_uint_8 type) {
void *m;
void *m = malloc(size);
if (m == NULL) {
/* TODO BrFailure(); call*/
}
return m;
}
// Offset: 110
// Size: 38
void BrStdlibFree(void *mem) {
free(mem);
}
// Offset: 164
// Size: 40
br_size_t BrStdlibInquire(br_uint_8 type) {
return 0;
}
// Offset: 218
// Size: 40
br_uint_32 BrStdlibAlign(br_uint_8 type) {
return sizeof(void *)
}