/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ret = vsnprintf(ptr, 128, fmt, ap); if (ret < 0) {
free_impl(ptr);
*str = NULL; return -1;
}
_ptr = reinterpret_cast<char*>(realloc_impl(ptr, ret + 1)); if (_ptr == NULL) {
free_impl(ptr);
*str = NULL; return -1;
}
*str = _ptr;
return ret;
}
MOZ_MEMORY_API int asprintf_impl(char** str, constchar* fmt, ...) { int ret;
va_list ap;
va_start(ap, fmt);
ret = vasprintf_impl(str, fmt, ap);
va_end(ap);
return ret;
} #endif
#ifdef XP_WIN # include <wchar.h>
// We also need to provide our own impl of wcsdup so that we don't ask // the CRT for memory from its heap (which will then be unfreeable).
MOZ_MEMORY_API wchar_t* wcsdup_impl(constwchar_t* src) {
size_t len = wcslen(src); wchar_t* dst = (wchar_t*)malloc_impl((len + 1) * sizeof(wchar_t)); if (dst) wcsncpy(dst, src, len + 1); return dst;
}
// jemalloc has _aligned_malloc, and friends. libc++.a contains // references to __imp__aligned_malloc (and friends) because it // is declared dllimport in the headers. // // The linker sees jemalloc's _aligned_malloc symbol in our objects, // but then libc++.a comes along and needs __imp__aligned_malloc, which // pulls in those parts of libucrt.a (or libmsvcrt.a in practice), // which define both __imp__aligned_malloc and _aligned_malloc, and // this causes a conflict. (And repeat for each of the symbols defined // here.) // // The fix is to define not only an _aligned_malloc symbol (via an // alias), but also define the __imp__aligned_malloc pointer to it. // This prevents those parts of libucrt from being pulled in and causing // conflicts. // This is done with __MINGW_IMP_SYMBOL to handle x86/x64 differences. void (*__MINGW_IMP_SYMBOL(_aligned_free))(void*) = _aligned_free; void* (*__MINGW_IMP_SYMBOL(_aligned_malloc))(size_t, size_t) = _aligned_malloc; char* (*__MINGW_IMP_SYMBOL(_strdup))(constchar* src) = _strdup;
MOZ_END_EXTERN_C # endif #endif// XP_WIN
¤ Dauer der Verarbeitung: 0.27 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.