[libc-commits] [libc] [libc] Implement vasprintf and asprintf (PR #98824)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Mon Jul 22 12:56:33 PDT 2024
================
@@ -0,0 +1,25 @@
+//===-- Implementation of asprintf -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdio/asprintf.h"
+#include "src/__support/OSUtil/io.h"
+#include "src/__support/macros/config.h"
+#include "src/stdio/vasprintf.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, asprintf,
+ (char **__restrict buffer, const char *format, ...)) {
+ va_list vlist;
+ va_start(vlist, format);
+ int ret = LIBC_NAMESPACE::vasprintf(buffer, format, vlist);
----------------
michaelrj-google wrote:
this should be handled by a shared `vasprintf_internal` like how `vsprintf_internal` is set up
https://github.com/llvm/llvm-project/pull/98824
More information about the libc-commits
mailing list