summaryrefslogtreecommitdiff
path: root/libc/src/stdio/printf_core/printf_main.h
diff options
context:
space:
mode:
authorKewen Meng <Kewen.Meng@amd.com>2025-11-04 19:43:16 -0800
committerGitHub <noreply@github.com>2025-11-04 19:43:16 -0800
commitc5aaee0bb07b221e5d3314bbdcf1abc4a604d6bd (patch)
tree1ca3e705faf3c443a3da43eb8ffe24be88e9cec9 /libc/src/stdio/printf_core/printf_main.h
parentf291f335c9628ea8d855fcc7c246171d70ceff58 (diff)
Revert commit d8e5698 and 15b19c7 (#166498)
Diffstat (limited to 'libc/src/stdio/printf_core/printf_main.h')
-rw-r--r--libc/src/stdio/printf_core/printf_main.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/stdio/printf_core/printf_main.h
index 1c7a7237c097..57f29858d529 100644
--- a/libc/src/stdio/printf_core/printf_main.h
+++ b/libc/src/stdio/printf_core/printf_main.h
@@ -10,7 +10,6 @@
#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H
#include "src/__support/arg_list.h"
-#include "src/__support/error_or.h"
#include "src/__support/macros/config.h"
#include "src/stdio/printf_core/converter.h"
#include "src/stdio/printf_core/core_structs.h"
@@ -23,9 +22,8 @@ namespace LIBC_NAMESPACE_DECL {
namespace printf_core {
template <WriteMode write_mode>
-ErrorOr<size_t> printf_main(Writer<write_mode> *writer,
- const char *__restrict str,
- internal::ArgList &args) {
+int printf_main(Writer<write_mode> *writer, const char *__restrict str,
+ internal::ArgList &args) {
Parser<internal::ArgList> parser(str, args);
int result = 0;
for (FormatSection cur_section = parser.get_next_section();
@@ -35,8 +33,9 @@ ErrorOr<size_t> printf_main(Writer<write_mode> *writer,
result = convert(writer, cur_section);
else
result = writer->write(cur_section.raw_string);
+
if (result < 0)
- return Error(-result);
+ return result;
}
return writer->get_chars_written();