diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 21:22:14 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 21:26:23 +0100 |
commit | c6e1454fbb872aed5d445d458958943556271529 (patch) | |
tree | 4951f6a95e4ddead170a355940822f8c86b6ed63 /stage3/cheese3d.c | |
parent | 59f22bc7ce5bbadf62722f3db5c93b45e86e4cca (diff) | |
download | cuddles-c6e1454fbb872aed5d445d458958943556271529.tar.xz |
rename some functions to not use standard names
this avoids confusion when some of those functions differ subtly from their standard versions.
free -> kfree
realloc -> krealloc
malloc -> kmalloc
rationale: kmalloc() behaves different from malloc() in that it will never return NULL. it will panic on OOM. try_kmalloc behaves like the usual malloc.
memcpy -> lmemcpy
memcpy_r -> rmemcpy
rationale: by design, lmemcpy() and rmemcpy() allow memory areas to overlap. the 'l' and 'r' indicate the direction of the copy operation.
Diffstat (limited to 'stage3/cheese3d.c')
-rw-r--r-- | stage3/cheese3d.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/stage3/cheese3d.c b/stage3/cheese3d.c index 154ce58..bd0b3e0 100644 --- a/stage3/cheese3d.c +++ b/stage3/cheese3d.c @@ -11,8 +11,8 @@ cheese3d_ctx cheese3d_create(u32 width, u32 height, u32 pitch, u32 bgcolor) .height = height, .pitch = pitch, .bgcolor = bgcolor, - .depth_buffer = malloc(gfx_info->width * gfx_info->height * sizeof(u32)), - .color_buffer = malloc(gfx_info->pitch * gfx_info->height), + .depth_buffer = kmalloc(gfx_info->width * gfx_info->height * sizeof(u32)), + .color_buffer = kmalloc(gfx_info->pitch * gfx_info->height), }; } @@ -23,8 +23,8 @@ cheese3d_ctx cheese3d_create_default(u32 bgcolor) void cheese3d_destroy(cheese3d_ctx ctx) { - free(ctx.depth_buffer); - free(ctx.color_buffer); + kfree(ctx.depth_buffer); + kfree(ctx.color_buffer); } void cheese3d_clear(cheese3d_ctx ctx, bool color, bool depth) @@ -144,5 +144,5 @@ void cheese3d_render(cheese3d_ctx ctx, usize num, vertex *vertices, texture *tex void cheese3d_display(cheese3d_ctx ctx) { - memcpy((void *) (u64) gfx_info->framebuffer, ctx.color_buffer, gfx_info->pitch * gfx_info->height); + lmemcpy((void *) (u64) gfx_info->framebuffer, ctx.color_buffer, gfx_info->pitch * gfx_info->height); } |