[libcxx-commits] [libcxx] [libc++][z/OS] Move z/OS to new locale API and resolve all name collisions (PR #165428)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 28 16:42:32 PDT 2025
================
@@ -0,0 +1,51 @@
+//===-----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___SUPPORT_IBMVASPRINTF_H
+#define _LIBCPP___SUPPORT_IBMVASPRINTF_H
+
+#include <cstdlib> // malloc, realloc
+#include <stdarg.h> // va_copy, va_end
+#include <stdio.h> // vsnprintf
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __ibm {
+
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char* fmt, va_list ap) {
+ const size_t buff_size = 256;
+ if ((*strp = (char*)malloc(buff_size)) == nullptr) {
----------------
ldionne wrote:
```suggestion
if ((*strp = (char*)std::malloc(buff_size)) == nullptr) {
```
Similarly, let's qualify the other functions we can in namespace std. This is what we do consistently for free functions.
https://github.com/llvm/llvm-project/pull/165428
More information about the libcxx-commits
mailing list