xref: /llvm-project/libc/src/stdio/generic/vfprintf.cpp (revision 40effc7af5679b7d54d3176a5eef2cdee1962ecd)
1*40effc7aSJoseph Huber //===-- Implementation of vfprintf ------------------------------*- C++ -*-===//
2*40effc7aSJoseph Huber //
3*40effc7aSJoseph Huber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*40effc7aSJoseph Huber // See https://llvm.org/LICENSE.txt for license information.
5*40effc7aSJoseph Huber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*40effc7aSJoseph Huber //
7*40effc7aSJoseph Huber //===----------------------------------------------------------------------===//
8*40effc7aSJoseph Huber 
9*40effc7aSJoseph Huber #include "src/stdio/vfprintf.h"
10*40effc7aSJoseph Huber 
11*40effc7aSJoseph Huber #include "src/__support/File/file.h"
12*40effc7aSJoseph Huber #include "src/__support/arg_list.h"
13*40effc7aSJoseph Huber #include "src/__support/macros/config.h"
14*40effc7aSJoseph Huber #include "src/stdio/printf_core/vfprintf_internal.h"
15*40effc7aSJoseph Huber 
16*40effc7aSJoseph Huber #include "hdr/types/FILE.h"
17*40effc7aSJoseph Huber #include <stdarg.h>
18*40effc7aSJoseph Huber 
19*40effc7aSJoseph Huber namespace LIBC_NAMESPACE_DECL {
20*40effc7aSJoseph Huber 
21*40effc7aSJoseph Huber LLVM_LIBC_FUNCTION(int, vfprintf,
22*40effc7aSJoseph Huber                    (::FILE *__restrict stream, const char *__restrict format,
23*40effc7aSJoseph Huber                     va_list vlist)) {
24*40effc7aSJoseph Huber   internal::ArgList args(vlist); // This holder class allows for easier copying
25*40effc7aSJoseph Huber                                  // and pointer semantics, as well as handling
26*40effc7aSJoseph Huber                                  // destruction automatically.
27*40effc7aSJoseph Huber   int ret_val = printf_core::vfprintf_internal(stream, format, args);
28*40effc7aSJoseph Huber   return ret_val;
29*40effc7aSJoseph Huber }
30*40effc7aSJoseph Huber 
31*40effc7aSJoseph Huber } // namespace LIBC_NAMESPACE_DECL
32