| 1 | //===-- Implementation of vasprintf -----------------------------*- 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/vasprintf.h" |
| 10 | #include "src/__support/arg_list.h" |
| 11 | #include "src/stdio/printf_core/vasprintf_internal.h" |
| 12 | |
| 13 | namespace LIBC_NAMESPACE_DECL { |
| 14 | |
| 15 | LLVM_LIBC_FUNCTION(int, vasprintf, |
| 16 | (char **__restrict ret, const char *__restrict format, |
| 17 | va_list vlist)) { |
| 18 | internal::ArgList args(vlist); // This holder class allows for easier copying |
| 19 | // and pointer semantics, as well as handling |
| 20 | // destruction automatically. |
| 21 | return printf_core::vasprintf_internal(ret, format, args); |
| 22 | } |
| 23 | |
| 24 | } // namespace LIBC_NAMESPACE_DECL |
| 25 | |