- AnyList now also defaults to the temp allocator.

- `os::getcwd` and `os::get_home_dir` requires an explicit allocator.
- `file::load_new` and `file::load_path_new` removed.
This commit is contained in:
Christoffer Lerno
2025-03-18 18:34:52 +01:00
parent cfc87a9d66
commit 7e100472e7
15 changed files with 45 additions and 44 deletions

View File

@@ -66,7 +66,7 @@ fn bool set_var(String name, String value, bool overwrite = true) => @pool()
<*
Returns the current user's home directory.
*>
fn String? get_home_dir(Allocator using = allocator::heap())
fn String? get_home_dir(Allocator allocator)
{
String home;
$if !env::WIN32:
@@ -74,7 +74,7 @@ fn String? get_home_dir(Allocator using = allocator::heap())
$else
home = "USERPROFILE";
$endif
return get_var(using, home);
return get_var(allocator, home);
}

View File

@@ -93,7 +93,7 @@ fn uptr? load_address() @local
}
fn Backtrace? backtrace_load_element(String execpath, void* buffer, void* load_address, Allocator allocator = allocator::heap()) @local
fn Backtrace? backtrace_load_element(Allocator allocator, String execpath, void* buffer, void* load_address) @local
{
@pool()
{
@@ -150,7 +150,7 @@ fn BacktraceList? symbolize_backtrace(Allocator allocator, void*[] backtrace)
String execpath = executable_path(tmem())!;
foreach (addr : backtrace)
{
list.push(backtrace_load_element(execpath, addr, load_addr, allocator) ?? backtrace::BACKTRACE_UNKNOWN);
list.push(backtrace_load_element(allocator, execpath, addr, load_addr) ?? backtrace::BACKTRACE_UNKNOWN);
}
};
return list;

View File

@@ -26,7 +26,7 @@ macro ObjcClass? class_by_name(ZString c)
return cls ?: CLASS_NOT_FOUND?;
}
macro ObjcClass[] class_get_list(Allocator allocator = allocator::heap())
macro ObjcClass[] class_get_list(Allocator allocator)
{
int num_classes = objc::getClassList(null, 0);
if (!num_classes) return {};