mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
More deprecations in lib6, and updates to lib7
This commit is contained in:
@@ -107,29 +107,13 @@ macro AnyList.pop(&self, $Type)
|
||||
Pop the last value and allocate the copy using the given allocator.
|
||||
@return! IteratorResult.NO_MORE_ELEMENT
|
||||
*>
|
||||
fn any! AnyList.copy_pop(&self, Allocator allocator = allocator::heap())
|
||||
fn any! AnyList.copy_pop(&self, Allocator allocator)
|
||||
{
|
||||
if (!self.size) return IteratorResult.NO_MORE_ELEMENT?;
|
||||
defer self.free_element(self.entries[self.size]);
|
||||
return allocator::clone_any(allocator, self.entries[--self.size]);
|
||||
}
|
||||
|
||||
<*
|
||||
Pop the last value and allocate the copy using the given allocator.
|
||||
@return! IteratorResult.NO_MORE_ELEMENT
|
||||
@deprecated `use copy_pop`
|
||||
*>
|
||||
fn any! AnyList.new_pop(&self, Allocator allocator = allocator::heap())
|
||||
{
|
||||
return self.copy_pop(allocator);
|
||||
}
|
||||
|
||||
<*
|
||||
Pop the last value and allocate the copy using the temp allocator
|
||||
@return! IteratorResult.NO_MORE_ELEMENT
|
||||
@deprecated `use tcopy_pop`
|
||||
*>
|
||||
fn any! AnyList.temp_pop(&self) => self.copy_pop(tmem());
|
||||
|
||||
<*
|
||||
Pop the last value and allocate the copy using the temp allocator
|
||||
@@ -176,17 +160,9 @@ fn any! AnyList.pop_first_retained(&self)
|
||||
return self.entries[0];
|
||||
}
|
||||
|
||||
<*
|
||||
Same as new_pop() but pops the first value instead.
|
||||
@deprecated `use copy_pop_first`
|
||||
*>
|
||||
fn any! AnyList.new_pop_first(&self, Allocator allocator = allocator::heap())
|
||||
{
|
||||
return self.copy_pop_first(allocator) @inline;
|
||||
}
|
||||
|
||||
<*
|
||||
Same as new_pop() but pops the first value instead.
|
||||
Same as copy_pop() but pops the first value instead.
|
||||
*>
|
||||
fn any! AnyList.copy_pop_first(&self, Allocator allocator = allocator::heap())
|
||||
{
|
||||
@@ -201,12 +177,6 @@ fn any! AnyList.copy_pop_first(&self, Allocator allocator = allocator::heap())
|
||||
*>
|
||||
fn any! AnyList.tcopy_pop_first(&self) => self.copy_pop_first(tmem());
|
||||
|
||||
<*
|
||||
Same as temp_pop() but pops the first value instead.
|
||||
@deprecated `use tcopy_pop_first`
|
||||
*>
|
||||
fn any! AnyList.temp_pop_first(&self) => self.new_pop_first(tmem());
|
||||
|
||||
<*
|
||||
@require index < self.size
|
||||
*>
|
||||
|
||||
@@ -32,7 +32,7 @@ fn DString new_with_capacity(Allocator allocator, usz capacity)
|
||||
return (DString){}.init(allocator, capacity);
|
||||
}
|
||||
|
||||
fn DString tnew_with_capacity(usz capacity) => new_with_capacity(tmem(), capacity) @inline;
|
||||
fn DString temp_with_capacity(usz capacity) => new_with_capacity(tmem(), capacity) @inline;
|
||||
|
||||
fn DString new(Allocator allocator, String c = "")
|
||||
{
|
||||
@@ -46,7 +46,7 @@ fn DString new(Allocator allocator, String c = "")
|
||||
return (DString)data;
|
||||
}
|
||||
|
||||
fn DString tnew(String s = "") => new(tmem(), s) @inline;
|
||||
fn DString temp(String s = "") => new(tmem(), s) @inline;
|
||||
|
||||
|
||||
fn void DString.replace_char(self, char ch, char replacement)
|
||||
@@ -297,7 +297,7 @@ fn void DString.append_chars(&self, String str)
|
||||
if (!other_len) return;
|
||||
if (!*self)
|
||||
{
|
||||
*self = tnew(str);
|
||||
*self = temp(str);
|
||||
return;
|
||||
}
|
||||
self.reserve(other_len);
|
||||
@@ -339,7 +339,7 @@ fn void DString.append_char(&self, char c)
|
||||
{
|
||||
if (!*self)
|
||||
{
|
||||
*self = tnew_with_capacity(MIN_CAPACITY);
|
||||
*self = temp_with_capacity(MIN_CAPACITY);
|
||||
}
|
||||
self.reserve(1);
|
||||
StringData* data = self.data();
|
||||
@@ -607,7 +607,7 @@ fn void DString.reserve(&self, usz addition)
|
||||
StringData* data = self.data();
|
||||
if (!data)
|
||||
{
|
||||
*self = dstring::tnew_with_capacity(addition);
|
||||
*self = dstring::temp_with_capacity(addition);
|
||||
return;
|
||||
}
|
||||
usz len = data.len + addition;
|
||||
|
||||
@@ -123,7 +123,7 @@ fn bool run_benchmarks(BenchmarkUnit[] benchmarks) @if(!$$OLD_TEST)
|
||||
|
||||
usz len = max_name + 9;
|
||||
|
||||
DString name = dstring::tnew_with_capacity(64);
|
||||
DString name = dstring::temp_with_capacity(64);
|
||||
name.append_repeat('-', len / 2);
|
||||
name.append(" BENCHMARKS ");
|
||||
name.append_repeat('-', len - len / 2);
|
||||
|
||||
@@ -238,7 +238,7 @@ fn bool run_tests(String[] args, TestUnit[] tests) @private
|
||||
int tests_passed = 0;
|
||||
int tests_skipped = 0;
|
||||
int test_count = tests.len;
|
||||
DString name = dstring::tnew_with_capacity(64);
|
||||
DString name = dstring::temp_with_capacity(64);
|
||||
usz len = max_name + 9;
|
||||
name.append_repeat('-', len / 2);
|
||||
name.append(" TESTS ");
|
||||
|
||||
@@ -41,7 +41,7 @@ fault NumberConversion
|
||||
*>
|
||||
fn ZString tformat_zstr(String fmt, args...)
|
||||
{
|
||||
DString str = dstring::tnew_with_capacity(fmt.len + args.len * 8);
|
||||
DString str = dstring::temp_with_capacity(fmt.len + args.len * 8);
|
||||
str.appendf(fmt, ...args);
|
||||
return str.zstr_view();
|
||||
}
|
||||
@@ -54,7 +54,7 @@ fn ZString tformat_zstr(String fmt, args...)
|
||||
*>
|
||||
fn String format(Allocator allocator, String fmt, args...) => @pool(allocator)
|
||||
{
|
||||
DString str = dstring::tnew_with_capacity(fmt.len + args.len * 8);
|
||||
DString str = dstring::temp_with_capacity(fmt.len + args.len * 8);
|
||||
str.appendf(fmt, ...args);
|
||||
return str.copy_str(allocator);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ fn String format(Allocator allocator, String fmt, args...) => @pool(allocator)
|
||||
*>
|
||||
fn String tformat(String fmt, args...)
|
||||
{
|
||||
DString str = dstring::tnew_with_capacity(fmt.len + args.len * 8);
|
||||
DString str = dstring::temp_with_capacity(fmt.len + args.len * 8);
|
||||
str.appendf(fmt, ...args);
|
||||
return str.str_view();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ fn String join(Allocator allocator, String[] s, String joiner)
|
||||
}
|
||||
@pool(allocator)
|
||||
{
|
||||
DString res = dstring::tnew_with_capacity(total_size);
|
||||
DString res = dstring::temp_with_capacity(total_size);
|
||||
res.append(s[0]);
|
||||
foreach (String* &str : s[1..])
|
||||
{
|
||||
@@ -671,8 +671,8 @@ fn String! new_from_wstring(Allocator allocator, WString wstring)
|
||||
return new_from_utf16(allocator, utf16);
|
||||
}
|
||||
|
||||
fn String! tnew_from_wstring(WString wstring) => new_from_wstring(tmem(), wstring) @inline;
|
||||
fn String! tnew_from_utf16(Char16[] utf16) => new_from_utf16(tmem(), utf16) @inline;
|
||||
fn String! temp_from_wstring(WString wstring) => new_from_wstring(tmem(), wstring) @inline;
|
||||
fn String! temp_from_utf16(Char16[] utf16) => new_from_utf16(tmem(), utf16) @inline;
|
||||
|
||||
fn usz String.utf8_codepoints(s)
|
||||
{
|
||||
@@ -831,4 +831,4 @@ macro String new_from_struct(Allocator allocator, x)
|
||||
};
|
||||
}
|
||||
|
||||
macro String tnew_from_struct(x) => new_from_struct(tmem(), x);
|
||||
macro String temp_from_struct(x) => new_from_struct(tmem(), x);
|
||||
|
||||
@@ -27,8 +27,7 @@ macro bool is_struct_with_default_print($Type)
|
||||
{
|
||||
return $Type.kindof == STRUCT
|
||||
&&& !$defined($Type.to_format)
|
||||
&&& !$defined($Type.to_new_string)
|
||||
&&& !$defined($Type.to_string);
|
||||
&&& !$defined($Type.to_constant_string);
|
||||
}
|
||||
|
||||
<*
|
||||
|
||||
@@ -68,7 +68,7 @@ macro String! readline(Allocator allocator, stream = io::stdin())
|
||||
if (val == '\n') return "";
|
||||
@pool(allocator)
|
||||
{
|
||||
DString str = dstring::tnew_with_capacity(256);
|
||||
DString str = dstring::temp_with_capacity(256);
|
||||
if (val != '\r') str.append(val);
|
||||
while (1)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ fn PathList! native_ls(Path dir, bool no_dirs, bool no_symlinks, String mask, Al
|
||||
if (no_dirs && (find_data.dwFileAttributes & win32::FILE_ATTRIBUTE_DIRECTORY)) continue;
|
||||
@pool(allocator)
|
||||
{
|
||||
String filename = string::tnew_from_wstring((WString)&find_data.cFileName)!;
|
||||
String filename = string::temp_from_wstring((WString)&find_data.cFileName)!;
|
||||
if (filename == ".." || filename == ".") continue;
|
||||
list.push(path::new(allocator, filename)!);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ fn Path! native_temp_directory(Allocator allocator) @if(env::WIN32) => @pool(all
|
||||
if (!len) return IoError.GENERAL_ERROR?;
|
||||
Char16[] buff = mem::temp_alloc_array(Char16, len + (usz)1);
|
||||
if (!win32::getTempPathW(len, buff)) return IoError.GENERAL_ERROR?;
|
||||
return path::new(allocator, string::tnew_from_utf16(buff[:len]));
|
||||
return path::new(allocator, string::temp_from_utf16(buff[:len]));
|
||||
}
|
||||
|
||||
module std::io::os @if(env::NO_LIBC);
|
||||
|
||||
@@ -52,7 +52,7 @@ macro void! chdir(path)
|
||||
$if @typeis(path, String):
|
||||
@pool()
|
||||
{
|
||||
return os::native_chdir(tnew(path));
|
||||
return os::native_chdir(temp(path));
|
||||
};
|
||||
$else
|
||||
return os::native_chdir(path) @inline;
|
||||
@@ -100,7 +100,7 @@ enum MkdirPermissions
|
||||
macro bool! mkdir(Path path, bool recursive = false, MkdirPermissions permissions = NORMAL)
|
||||
{
|
||||
$if @typeis(path, String):
|
||||
@pool() { return _mkdir(tnew(path), recursive, permissions); };
|
||||
@pool() { return _mkdir(temp(path), recursive, permissions); };
|
||||
$else
|
||||
return _mkdir(path, recursive, permissions);
|
||||
$endif
|
||||
@@ -118,7 +118,7 @@ macro bool! mkdir(Path path, bool recursive = false, MkdirPermissions permission
|
||||
macro bool! rmdir(path)
|
||||
{
|
||||
$if @typeis(path, String):
|
||||
@pool() { return _rmdir(tnew(path)); };
|
||||
@pool() { return _rmdir(temp(path)); };
|
||||
$else
|
||||
return _mkdir(path);
|
||||
$endif
|
||||
@@ -152,14 +152,14 @@ fn Path! new(Allocator allocator, String path, PathEnv path_env = DEFAULT_ENV)
|
||||
|
||||
@return! PathResult.INVALID_PATH `if the path was invalid`
|
||||
*>
|
||||
fn Path! tnew(String path, PathEnv path_env = DEFAULT_ENV)
|
||||
fn Path! temp(String path, PathEnv path_env = DEFAULT_ENV)
|
||||
{
|
||||
return new(tmem(), path, path_env);
|
||||
}
|
||||
|
||||
fn Path! from_win32_wstring(Allocator allocator, WString path) => @pool(allocator)
|
||||
{
|
||||
return path::new(allocator, string::tnew_from_wstring(path)!);
|
||||
return path::new(allocator, string::temp_from_wstring(path)!);
|
||||
}
|
||||
|
||||
fn Path! for_windows(Allocator allocator, String path)
|
||||
@@ -189,7 +189,7 @@ fn Path! Path.append(self, Allocator allocator, String filename)
|
||||
|
||||
@pool(allocator)
|
||||
{
|
||||
DString dstr = dstring::tnew_with_capacity(self.path_string.len + 1 + filename.len);
|
||||
DString dstr = dstring::temp_with_capacity(self.path_string.len + 1 + filename.len);
|
||||
dstr.append(self.path_string);
|
||||
dstr.append(PREFERRED_SEPARATOR);
|
||||
dstr.append(filename);
|
||||
@@ -223,7 +223,7 @@ fn usz! start_of_base_name(String str, PathEnv path_env) @local
|
||||
|
||||
fn bool! String.is_absolute_path(self) => @pool()
|
||||
{
|
||||
return tnew(self).is_absolute();
|
||||
return temp(self).is_absolute();
|
||||
}
|
||||
|
||||
fn bool! Path.is_absolute(self)
|
||||
@@ -238,7 +238,7 @@ fn bool! Path.is_absolute(self)
|
||||
|
||||
fn Path! String.to_absolute_path(self, Allocator allocator) => @pool(allocator)
|
||||
{
|
||||
return tnew(self).absolute(allocator);
|
||||
return temp(self).absolute(allocator);
|
||||
}
|
||||
|
||||
<*
|
||||
@@ -274,7 +274,7 @@ fn Path! Path.absolute(self, Allocator allocator)
|
||||
|
||||
fn String! String.file_basename(self, Allocator allocator) => @pool(allocator)
|
||||
{
|
||||
return tnew(self).basename().copy(allocator);
|
||||
return temp(self).basename().copy(allocator);
|
||||
}
|
||||
|
||||
fn String! String.file_tbasename(self) => self.file_basename(tmem());
|
||||
@@ -291,7 +291,7 @@ fn String! String.path_tdirname(self) => self.path_dirname(tmem());
|
||||
|
||||
fn String! String.path_dirname(self, Allocator allocator) => @pool(allocator)
|
||||
{
|
||||
return tnew(self).dirname().copy(allocator);
|
||||
return temp(self).dirname().copy(allocator);
|
||||
}
|
||||
|
||||
fn String Path.dirname(self)
|
||||
|
||||
@@ -80,7 +80,7 @@ macro usz! read_all(stream, char[] buffer)
|
||||
<*
|
||||
@require @is_instream(stream)
|
||||
*>
|
||||
macro char[]! read_new_fully(stream, Allocator allocator = allocator::heap())
|
||||
macro char[]! read_fully(Allocator allocator, stream)
|
||||
{
|
||||
usz len = available(stream)!;
|
||||
char* data = allocator::malloc_try(allocator, len)!;
|
||||
|
||||
@@ -16,7 +16,7 @@ struct ByteBuffer (InStream, OutStream)
|
||||
max_read defines how many bytes might be kept before its internal buffer is shrinked.
|
||||
@require self.bytes.len == 0 "Buffer already initialized."
|
||||
*>
|
||||
fn ByteBuffer* ByteBuffer.new_init(&self, usz max_read, usz initial_capacity = 16, Allocator allocator = allocator::heap())
|
||||
fn ByteBuffer* ByteBuffer.init(&self, Allocator allocator, usz max_read, usz initial_capacity = 16)
|
||||
{
|
||||
*self = { .allocator = allocator, .max_read = max_read };
|
||||
initial_capacity = max(initial_capacity, 16);
|
||||
@@ -24,9 +24,9 @@ fn ByteBuffer* ByteBuffer.new_init(&self, usz max_read, usz initial_capacity = 1
|
||||
return self;
|
||||
}
|
||||
|
||||
fn ByteBuffer* ByteBuffer.temp_init(&self, usz max_read, usz initial_capacity = 16)
|
||||
fn ByteBuffer* ByteBuffer.tinit(&self, usz max_read, usz initial_capacity = 16)
|
||||
{
|
||||
return self.new_init(max_read, initial_capacity, allocator::temp());
|
||||
return self.init(tmem(), max_read, initial_capacity);
|
||||
}
|
||||
|
||||
<*
|
||||
|
||||
@@ -14,7 +14,7 @@ struct ByteWriter (OutStream)
|
||||
@require self.bytes.len == 0 "Init may not run on already initialized data"
|
||||
@ensure (bool)allocator, self.index == 0
|
||||
*>
|
||||
fn ByteWriter* ByteWriter.new_init(&self, Allocator allocator = allocator::heap())
|
||||
fn ByteWriter* ByteWriter.init(&self, Allocator allocator)
|
||||
{
|
||||
*self = { .bytes = {}, .allocator = allocator };
|
||||
return self;
|
||||
@@ -25,9 +25,9 @@ fn ByteWriter* ByteWriter.new_init(&self, Allocator allocator = allocator::heap(
|
||||
@require self.bytes.len == 0 "Init may not run on already initialized data"
|
||||
@ensure self.index == 0
|
||||
*>
|
||||
fn ByteWriter* ByteWriter.temp_init(&self)
|
||||
fn ByteWriter* ByteWriter.tinit(&self)
|
||||
{
|
||||
return self.new_init(allocator::temp()) @inline;
|
||||
return self.init(tmem()) @inline;
|
||||
}
|
||||
|
||||
fn ByteWriter* ByteWriter.init_with_buffer(&self, char[] data)
|
||||
|
||||
@@ -18,7 +18,7 @@ struct MultiReader (InStream)
|
||||
@require self.readers.len == 0 "Init may not run on already initialized data"
|
||||
@ensure self.index == 0
|
||||
*>
|
||||
fn MultiReader* MultiReader.new_init(&self, InStream... readers, Allocator allocator = allocator::heap())
|
||||
fn MultiReader* MultiReader.init(&self, Allocator allocator, InStream... readers)
|
||||
{
|
||||
InStream []copy = allocator::new_array(allocator, InStream, readers.len);
|
||||
copy[..] = readers[..];
|
||||
@@ -31,9 +31,9 @@ fn MultiReader* MultiReader.new_init(&self, InStream... readers, Allocator alloc
|
||||
@require self.readers.len == 0 "Init may not run on already initialized data"
|
||||
@ensure self.index == 0
|
||||
*>
|
||||
fn MultiReader* MultiReader.temp_init(&self, InStream... readers)
|
||||
fn MultiReader* MultiReader.tinit(&self, InStream... readers)
|
||||
{
|
||||
return self.new_init(...readers, allocator: allocator::temp());
|
||||
return self.init(tmem(), ...readers);
|
||||
}
|
||||
|
||||
fn void MultiReader.free(&self)
|
||||
|
||||
@@ -15,7 +15,7 @@ struct MultiWriter (OutStream)
|
||||
@require writers.len > 0
|
||||
@require self.writers.len == 0 "Init may not run on already initialized data"
|
||||
*>
|
||||
fn MultiWriter* MultiWriter.new_init(&self, OutStream... writers, Allocator allocator = allocator::heap())
|
||||
fn MultiWriter* MultiWriter.init(&self, Allocator allocator, OutStream... writers)
|
||||
{
|
||||
OutStream[] copy = allocator::new_array(allocator, OutStream, writers.len);
|
||||
copy[..] = writers[..];
|
||||
@@ -28,9 +28,9 @@ fn MultiWriter* MultiWriter.new_init(&self, OutStream... writers, Allocator allo
|
||||
@require writers.len > 0
|
||||
@require self.writers.len == 0 "Init may not run on already initialized data"
|
||||
*>
|
||||
fn MultiWriter* MultiWriter.temp_init(&self, OutStream... writers)
|
||||
fn MultiWriter* MultiWriter.tinit(&self, OutStream... writers)
|
||||
{
|
||||
return self.new_init(...writers, allocator: allocator::temp());
|
||||
return self.init(tmem(), ...writers);
|
||||
}
|
||||
|
||||
fn void MultiWriter.free(&self)
|
||||
|
||||
@@ -255,7 +255,7 @@ fn bool InetAddress.is_multicast_link_local(InetAddress* addr)
|
||||
fn AddrInfo*! addrinfo(String host, uint port, AIFamily ai_family, AISockType ai_socktype) @if(os::SUPPORTS_INET) => @pool()
|
||||
{
|
||||
ZString zhost = host.zstr_tcopy();
|
||||
DString str = dstring::tnew_with_capacity(32);
|
||||
DString str = dstring::temp_with_capacity(32);
|
||||
str.appendf("%d", port);
|
||||
AddrInfo hints = { .ai_family = ai_family, .ai_socktype = ai_socktype };
|
||||
AddrInfo* ai;
|
||||
|
||||
@@ -254,15 +254,7 @@ struct UrlQueryValues
|
||||
@param [in] query
|
||||
@return "a UrlQueryValues HashMap"
|
||||
*>
|
||||
fn UrlQueryValues temp_parse_query(String query) => parse_query(query, allocator::temp());
|
||||
|
||||
<*
|
||||
Parse the query parameters of the Url into a UrlQueryValues map.
|
||||
|
||||
@param [in] query
|
||||
@return "a UrlQueryValues HashMap"
|
||||
*>
|
||||
fn UrlQueryValues new_parse_query(String query) => parse_query(query, allocator::heap());
|
||||
fn UrlQueryValues parse_query_to_temp(String query) => parse_query(tmem(), query);
|
||||
|
||||
<*
|
||||
Parse the query parameters of the Url into a UrlQueryValues map.
|
||||
@@ -271,7 +263,7 @@ fn UrlQueryValues new_parse_query(String query) => parse_query(query, allocator:
|
||||
@param [inout] allocator
|
||||
@return "a UrlQueryValues HashMap"
|
||||
*>
|
||||
fn UrlQueryValues parse_query(String query, Allocator allocator)
|
||||
fn UrlQueryValues parse_query(Allocator allocator, String query)
|
||||
{
|
||||
UrlQueryValues vals;
|
||||
vals.map.init(allocator);
|
||||
|
||||
@@ -70,7 +70,7 @@ fn usz encode_len(String s, UrlEncodingMode mode) @inline
|
||||
fn String encode(Allocator allocator, String s, UrlEncodingMode mode) => @pool(allocator)
|
||||
{
|
||||
usz n = encode_len(s, mode);
|
||||
DString builder = dstring::tnew_with_capacity(n);
|
||||
DString builder = dstring::temp_with_capacity(n);
|
||||
|
||||
foreach(i, c: s)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ fn usz! decode_len(String s, UrlEncodingMode mode) @inline
|
||||
fn String! decode(Allocator allocator, String s, UrlEncodingMode mode) => @pool(allocator)
|
||||
{
|
||||
usz n = decode_len(s, mode)!;
|
||||
DString builder = dstring::tnew_with_capacity(n);
|
||||
DString builder = dstring::temp_with_capacity(n);
|
||||
|
||||
for (usz i = 0; i < s.len; i++)
|
||||
{
|
||||
|
||||
@@ -77,15 +77,11 @@ fn String! get_home_dir(Allocator using = allocator::heap())
|
||||
return get_var(using, home);
|
||||
}
|
||||
|
||||
fn Path! get_config_dir(Allocator allocator = allocator::heap()) @deprecated("use new_get_config_dir()")
|
||||
{
|
||||
return new_get_config_dir(allocator) @inline;
|
||||
}
|
||||
|
||||
<*
|
||||
Returns the current user's config directory.
|
||||
*>
|
||||
fn Path! new_get_config_dir(Allocator allocator) => @pool(allocator)
|
||||
fn Path! get_config_dir(Allocator allocator) => @pool(allocator)
|
||||
{
|
||||
$if env::WIN32:
|
||||
return path::new(allocator, tget_var("AppData"));
|
||||
@@ -97,7 +93,7 @@ fn Path! new_get_config_dir(Allocator allocator) => @pool(allocator)
|
||||
String s = tget_var("XDG_CONFIG_HOME") ?? tget_var("HOME")!;
|
||||
const DIR = ".config";
|
||||
$endif
|
||||
return path::tnew(s).append(allocator, DIR);
|
||||
return path::temp(s).append(allocator, DIR);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ fn void! create_named_pipe_helper(void** rd, void **wr) @local @if(env::WIN32)
|
||||
|
||||
fn WString convert_command_line_win32(String[] command_line) @inline @if(env::WIN32) @local
|
||||
{
|
||||
DString str = dstring::tnew_with_capacity(512);
|
||||
DString str = dstring::temp_with_capacity(512);
|
||||
foreach LINE: (i, s : command_line)
|
||||
{
|
||||
if (i != 0) str.append(' ');
|
||||
@@ -138,7 +138,7 @@ fn SubProcess! create(String[] command_line, SubProcessOptions options = {}, Str
|
||||
WString used_environment = null;
|
||||
if (!options.inherit_environment)
|
||||
{
|
||||
DString env = dstring::tnew_with_capacity(64);
|
||||
DString env = dstring::temp_with_capacity(64);
|
||||
if (!environment.len)
|
||||
{
|
||||
env.append("\0");
|
||||
|
||||
@@ -173,7 +173,7 @@ fn void remove_all_pool_threads(EventThreadPool* pool) @local
|
||||
<*
|
||||
@require size > 0 "Must have at least one thread"
|
||||
*>
|
||||
fn EventThreadPool* EventThreadPool.new_init(&self, int size, String name, Allocator allocator, void* monitor_context)
|
||||
fn EventThreadPool* EventThreadPool.init(&self, int size, String name, Allocator allocator, void* monitor_context)
|
||||
{
|
||||
*self = { .is_alive = true, .name = name.copy(allocator), .monitor_context = monitor_context, .allocator = allocator };
|
||||
self.pool.init(allocator);
|
||||
|
||||
@@ -120,7 +120,7 @@ fn usz! NanoDuration.to_format(&self, Formatter* formatter) @dynamic
|
||||
bool neg = nd < 0;
|
||||
if (neg) nd = -nd;
|
||||
|
||||
DString str = dstring::tnew_with_capacity(64);
|
||||
DString str = dstring::temp_with_capacity(64);
|
||||
if (nd < 1_000_000_000)
|
||||
{
|
||||
// Less than 1s: print milliseconds, microseconds and nanoseconds.
|
||||
|
||||
Reference in New Issue
Block a user