1 //===-- Internal implementation of vfprintf ---------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "src/stdio/printf_core/vfprintf_internal.h"
10 
11 #include "src/__support/arg_list.h"
12 #include "src/stdio/printf_core/file_writer.h"
13 #include "src/stdio/printf_core/printf_main.h"
14 #include "src/stdio/printf_core/writer.h"
15 
16 #include <stdio.h>
17 
18 namespace __llvm_libc {
19 namespace printf_core {
20 
vfprintf_internal(::FILE * __restrict stream,const char * __restrict format,internal::ArgList & args)21 int vfprintf_internal(::FILE *__restrict stream, const char *__restrict format,
22                       internal::ArgList &args) {
23   FileWriter file_writer(stream);
24   printf_core::Writer writer(reinterpret_cast<void *>(&file_writer),
25                              printf_core::write_to_file);
26   return printf_core::printf_main(&writer, format, args);
27 }
28 
29 } // namespace printf_core
30 } // namespace __llvm_libc
31