/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: sw=2 ts=4 et :
*/ /* 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/. */
#ifdefined(__cplusplus) # include <new> // Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the // corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code // using things defined there. Specifically, with stdlib.h, the use of abs() // in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs() # include <cstdlib> #else # include <stdlib.h> #endif
#ifdefined(MOZ_MEMORY) && defined(IMPL_MFBT) # define MOZ_MEMORY_IMPL # include "mozmemory_wrap.h" # define MALLOC_FUNCS MALLOC_FUNCS_MALLOC // See mozmemory_wrap.h for more details. Files that are part of libmozglue, // need to use _impl suffixes, which is becoming cumbersome. We'll have to use // something like a malloc.h wrapper and allow the use of the functions without // a _impl suffix. In the meanwhile, this is enough to get by for C++ code. # define NOTHROW_MALLOC_DECL(name, return_type, ...) \
MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__) noexcept(true); # define MALLOC_DECL(name, return_type, ...) \
MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__); # include "malloc_decls.h" #endif
#ifdefined(__cplusplus) # include "mozilla/fallible.h" # include "mozilla/mozalloc_abort.h" # include "mozilla/TemplateLib.h" #endif #include"mozilla/Attributes.h" #include"mozilla/Types.h"
MOZ_BEGIN_EXTERN_C
/* * We need to use malloc_impl and free_impl in this file when they are * defined, because of how mozglue.dll is linked on Windows, where using * malloc/free would end up using the symbols from the MSVCRT instead of * ours.
*/ #ifndef free_impl # define free_impl free # define free_impl_ #endif #ifndef malloc_impl # define malloc_impl malloc # define malloc_impl_ #endif
/* * Each declaration below is analogous to a "standard" allocation * function, except that the out-of-memory handling is made explicit. * The |moz_x| versions will never return a NULL pointer; if memory * is exhausted, they abort. The |moz_| versions may return NULL * pointers if memory is exhausted: their return value must be checked. * * All these allocation functions are *guaranteed* to return a pointer * to memory allocated in such a way that that memory can be freed by * passing that pointer to |free()|.
*/
/* * Like moz_malloc_size_of(), but works reliably with interior pointers, i.e. * pointers into the middle of a live allocation.
*/
MFBT_API size_t moz_malloc_enclosing_size_of(constvoid* ptr);
MOZ_END_EXTERN_C
#ifdef __cplusplus
/* NB: This is defined with MFBT_API just to silence vacuous warnings * about symbol visibility on OS X/gcc. * These symbols are force-inline mainly for performance reasons, and * not exported. While the standard doesn't allow that, we are in a * controlled environment where the issues the standard tries to * prevent don't apply, and we can't end up in situations where
* operator new and operator delete are inconsistent. */ # ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Winline-new-delete" # endif
¤ 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.0.28Bemerkung:
(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.