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

via libc-commits libc-commits at lists.llvm.org
Sun Jul 14 10:37:22 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 92fe3911c3e0f5e76cf60c8b3203002e6e6aa047 a14b18204452a620832d2d3e99d48a340dd542e5 --extensions h,cpp -- libc/src/stdio/vasprintf.cpp libc/src/stdio/vasprintf.h libc/test/src/stdio/vasprintf_test.cpp libc/src/stdio/printf_core/writer.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/stdio/printf_core/writer.h b/libc/src/stdio/printf_core/writer.h
index 539d483ccf..7828d3a8f0 100644
--- a/libc/src/stdio/printf_core/writer.h
+++ b/libc/src/stdio/printf_core/writer.h
@@ -80,11 +80,11 @@ struct WriteBuffer {
   }
 
   // The overflow_write method is intended to be called to write the contents of
-  // the buffer and new_str to the stream_writer if it exists. If a resizing hook
-  // is provided, it will resize the buffer and write the contents. If neither a
-  // stream_writer nor a resizing hook is provided, it will fill the remaining
-  // space in the buffer with new_str and drop the overflow. Calling this with an
-  // empty string will flush the buffer if relevant.
+  // the buffer and new_str to the stream_writer if it exists. If a resizing
+  // hook is provided, it will resize the buffer and write the contents. If
+  // neither a stream_writer nor a resizing hook is provided, it will fill the
+  // remaining space in the buffer with new_str and drop the overflow. Calling
+  // this with an empty string will flush the buffer if relevant.
 
   LIBC_INLINE int overflow_write(cpp::string_view new_str) {
     // If there is resizing hook for this buffer, resize and write
diff --git a/libc/test/src/stdio/vasprintf_test.cpp b/libc/test/src/stdio/vasprintf_test.cpp
index c857b8c4a3..3c67e01c4d 100644
--- a/libc/test/src/stdio/vasprintf_test.cpp
+++ b/libc/test/src/stdio/vasprintf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for vasprintf --------------------------------------------===//
+//===-- Unittests for vasprintf
+//--------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

``````````

</details>


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


More information about the libc-commits mailing list