Skip to content

Commit 242b75c

Browse files
committed
Cleanup
1 parent eedbad9 commit 242b75c

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

libc/src/stdio/baremetal/printf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) {
5454
return -1;
5555
}
5656

57-
if (retval.value >= cpp::numeric_limits<int>::max()) {
57+
if (retval.value > cpp::numeric_limits<int>::max()) {
5858
libc_errno = EOVERFLOW;
5959
return -1;
6060
}

libc/src/stdio/baremetal/vprintf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace LIBC_NAMESPACE_DECL {
2222
namespace {
2323

2424
LIBC_INLINE int stdout_write_hook(cpp::string_view new_str, void *) {
25-
write_to_stdout(new_str);
25+
write_to_stdout(new_str);
2626
return printf_core::WRITE_OK;
2727
}
2828

@@ -53,7 +53,7 @@ LLVM_LIBC_FUNCTION(int, vprintf,
5353

5454
}
5555

56-
if (retval.value >= cpp::numeric_limits<int>::max()) {
56+
if (retval.value > cpp::numeric_limits<int>::max()) {
5757
libc_errno = EOVERFLOW;
5858
return -1;
5959
}

libc/src/stdio/printf_core/core_structs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct PrintfResult {
3131

3232
constexpr bool has_error() { return error != 0; }
3333

34-
// constexpr operator size_t() { return value; }
34+
constexpr operator size_t() { return value; }
3535
};
3636

3737
// These length modifiers match the length modifiers in the format string, which

libc/src/stdio/printf_core/printf_main.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ PrintfResult printf_main(Writer<write_mode> *writer, const char *__restrict str,
3030
!cur_section.raw_string.empty();
3131
cur_section = parser.get_next_section()) {
3232
if (cur_section.has_conv)
33-
result = convert(writer, cur_section); // look at usages
33+
result = convert(writer, cur_section);
3434
else
35-
result = writer->write(cur_section.raw_string); // look at usages
36-
35+
result = writer->write(cur_section.raw_string);
3736
if (result < 0)
3837
return {0, -result};
3938
}

0 commit comments

Comments
 (0)