[libc-commits] [libc] [libc]: Clean up unnecessary function pointers in scanf (PR #121215)
via libc-commits
libc-commits at lists.llvm.org
Fri Dec 27 08:33:11 PST 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 07ba4575250b692b28d0fd5105e028b9f4c8e07f d12a8f5bf4b8f8a51cb021262d6c533c9ff5d0da --extensions cpp,h -- libc/src/stdio/scanf_core/reader.cpp libc/src/stdio/scanf_core/reader.h libc/src/stdio/scanf_core/vfscanf_internal.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/stdio/scanf_core/reader.cpp b/libc/src/stdio/scanf_core/reader.cpp
index ccfcd220e1..e2dcdd5e1e 100644
--- a/libc/src/stdio/scanf_core/reader.cpp
+++ b/libc/src/stdio/scanf_core/reader.cpp
@@ -6,16 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#include "hdr/types/FILE.h"
#include "src/stdio/scanf_core/reader.h"
-#include "src/__support/macros/config.h"
+#include "hdr/types/FILE.h"
#include "src/__support/File/file.h"
+#include "src/__support/macros/config.h"
#include <stddef.h>
-
-
-
namespace LIBC_NAMESPACE_DECL {
namespace scanf_core {
@@ -51,7 +48,7 @@ LIBC_INLINE void ungetc(int c, void *f) {
reinterpret_cast<LIBC_NAMESPACE::File *>(f)->ungetc_unlocked(c);
}
-#else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE)
+#else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE)
// Since ungetc_unlocked isn't always available, we don't acquire the lock for
// system files.
diff --git a/libc/src/stdio/scanf_core/reader.h b/libc/src/stdio/scanf_core/reader.h
index e29ea6ea7d..c8b113b615 100644
--- a/libc/src/stdio/scanf_core/reader.h
+++ b/libc/src/stdio/scanf_core/reader.h
@@ -33,14 +33,13 @@ public:
// TODO: Set buff_len with a proper constant
LIBC_INLINE Reader(ReadBuffer *string_buffer) : rb(string_buffer) {}
- LIBC_INLINE Reader(void *stream,
- ReadBuffer *stream_buffer = nullptr)
- : rb(stream_buffer), input_stream(stream){}
+ LIBC_INLINE Reader(void *stream, ReadBuffer *stream_buffer = nullptr)
+ : rb(stream_buffer), input_stream(stream) {}
// This returns the next character from the input and advances it by one
// character. When it hits the end of the string or file it returns '\0' to
// signal to stop parsing.
- char getc();
+ char getc();
// This moves the input back by one character, placing c into the buffer if
// this is a file reader, else c is ignored.
``````````
</details>
https://github.com/llvm/llvm-project/pull/121215
More information about the libc-commits
mailing list