Add defaults to compare_exchange, small fix in printf. Disallow obviously wrong code that returns the pointer to a variable on the stack.

This commit is contained in:
Christoffer Lerno
2023-02-18 12:19:32 +01:00
parent 3da9008fdc
commit ea163636d3
6 changed files with 121 additions and 4 deletions

View File

@@ -69,7 +69,7 @@ fn char[]! bprintf(char[] buffer, String format, args...) @maydiscard
BufferData data = { .buffer = buffer };
formatter.init(&out_buffer_fn, &data);
usz size = formatter.vprintf(format, args)?;
return buffer[:size];
return buffer[:data.written];
}
fn usz! File.printf(File file, String format, args...) @maydiscard