avoid some unnecessary str8 copies now that arena-allocating string functions null terminate strings
This commit is contained in:
parent
463e6322a4
commit
0a83f26f7b
2
milepost
2
milepost
|
@ -1 +1 @@
|
|||
Subproject commit 4b491ee94a034d6a5a7d90a6f1a822a3d76b53f0
|
||||
Subproject commit ffb900d872a456cc5e7cc1762b1846c0c4df08cd
|
10
src/main.c
10
src/main.c
|
@ -47,12 +47,11 @@ mg_font orca_font_create(const char* resourcePath)
|
|||
{
|
||||
//NOTE(martin): create default font
|
||||
str8 fontPath = path_executable_relative(mem_scratch(), STR8(resourcePath));
|
||||
char* fontPathCString = str8_to_cstring(mem_scratch(), fontPath);
|
||||
|
||||
FILE* fontFile = fopen(fontPathCString, "r");
|
||||
FILE* fontFile = fopen(fontPath.ptr, "r");
|
||||
if(!fontFile)
|
||||
{
|
||||
log_error("Could not load font file '%s': %s\n", fontPathCString, strerror(errno));
|
||||
log_error("Could not load font file '%s': %s\n", fontPath.ptr, strerror(errno));
|
||||
return(mg_font_nil());
|
||||
}
|
||||
unsigned char* fontData = 0;
|
||||
|
@ -315,12 +314,11 @@ void* orca_runloop(void* user)
|
|||
//NOTE: loads wasm module
|
||||
const char* bundleNameCString = "module";
|
||||
str8 modulePath = path_executable_relative(mem_scratch(), STR8("../app/wasm/module.wasm"));
|
||||
const char* modulePathCString = str8_to_cstring(mem_scratch(), modulePath);
|
||||
|
||||
FILE* file = fopen(modulePathCString, "rb");
|
||||
FILE* file = fopen(modulePath.ptr, "rb");
|
||||
if(!file)
|
||||
{
|
||||
log_error("Couldn't load wasm module at %s\n", modulePathCString);
|
||||
log_error("Couldn't load wasm module at %s\n", modulePath.ptr);
|
||||
|
||||
const char* options[] = {"OK"};
|
||||
mp_alert_popup("Error",
|
||||
|
|
Loading…
Reference in New Issue