[libc-commits] [libc] [libc] Implement vasprintf (PR #98824)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Mon Jul 15 11:28:27 PDT 2024
================
@@ -23,15 +23,19 @@ namespace printf_core {
struct WriteBuffer {
using StreamWriter = int (*)(cpp::string_view, void *);
+ using ResizeOverflowWriter = int (*)(WriteBuffer *wb,
+ cpp::string_view new_str);
char *buff;
- const size_t buff_len;
+ size_t buff_len;
size_t buff_cur = 0;
// The stream writer will be called when the buffer is full. It will be passed
// string_views to write to the stream.
StreamWriter stream_writer;
void *output_target;
+ ResizeOverflowWriter resize_writer = nullptr;
----------------
michaelrj-google wrote:
you don't need to add this, just make `output_target` a pointer to this `WriteBuffer` and then reinterpret cast it back inside of the `StreamWriter` function
https://github.com/llvm/llvm-project/pull/98824
More information about the libc-commits
mailing list