mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Allow recursive function definitions as long as they are pointers #1182. Add 'zstr' variants for string::new_format / string::tformat.
This commit is contained in:
@@ -38,6 +38,13 @@ macro String tformat(String fmt, ...)
|
||||
return str.str_view();
|
||||
}
|
||||
|
||||
macro ZString tformat_zstr(String fmt, ...)
|
||||
{
|
||||
DString str = dstring::temp_with_capacity(fmt.len + $vacount * 8);
|
||||
str.appendf(fmt, $vasplat());
|
||||
return str.zstr_view();
|
||||
}
|
||||
|
||||
macro String new_format(String fmt, ..., Allocator* allocator = allocator::heap())
|
||||
{
|
||||
@pool(allocator)
|
||||
@@ -48,6 +55,15 @@ macro String new_format(String fmt, ..., Allocator* allocator = allocator::heap(
|
||||
};
|
||||
}
|
||||
|
||||
macro ZString new_format_zstr(String fmt, ..., Allocator* allocator = allocator::heap())
|
||||
{
|
||||
@pool(allocator)
|
||||
{
|
||||
DString str = dstring::temp_with_capacity(fmt.len + $vacount * 8);
|
||||
str.appendf(fmt, $vasplat());
|
||||
return str.copy_zstr(allocator);
|
||||
};
|
||||
}
|
||||
|
||||
macro bool char_in_set(char c, String set)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user