[libc-commits] [libc] [libc] Implement vasprintf (PR #98824)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Sun Jul 14 11:18:07 PDT 2024


================
@@ -41,41 +45,61 @@ struct WriteBuffer {
       : buff(Buff), buff_len(Buff_len), stream_writer(nullptr),
         output_target(nullptr) {}
 
+  LIBC_INLINE WriteBuffer(char *Buff, size_t Buff_len,
+                          ResizeOverflowWriter hook)
+      : buff(Buff), buff_len(Buff_len), stream_writer(nullptr),
+        output_target(nullptr), resize_writer(hook) {}
+
+  LIBC_INLINE int flush_to_stream(cpp::string_view new_str) {
+    if (buff_cur > 0) {
+      int retval = stream_writer({buff, buff_cur}, output_target);
+      if (retval < 0) {
+        return retval;
+      }
----------------
jhuber6 wrote:

```suggestion
      if (retval < 0)
        return retval;
```
Here and everywhere else, LLVM style omits braces on single line blocks.

https://github.com/llvm/llvm-project/pull/98824


More information about the libc-commits mailing list