зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625143 - Add returns_nonnull attributes to moz_x allocation routines. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D68367 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6f9a76e39c
Коммит
79b5dc835f
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
extern "C" MFBT_API void* moz_xmalloc(size_t size) MOZ_ALLOCATOR;
|
||||
extern "C" MFBT_API void* moz_xmalloc(size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
namespace std {
|
||||
struct nothrow_t;
|
||||
|
|
|
@ -75,21 +75,24 @@ MOZ_BEGIN_EXTERN_C
|
|||
* passing that pointer to |free()|.
|
||||
*/
|
||||
|
||||
MFBT_API void* moz_xmalloc(size_t size) MOZ_ALLOCATOR;
|
||||
MFBT_API void* moz_xmalloc(size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
MFBT_API void* moz_xcalloc(size_t nmemb, size_t size) MOZ_ALLOCATOR;
|
||||
MFBT_API void* moz_xcalloc(size_t nmemb, size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
MFBT_API void* moz_xrealloc(void* ptr, size_t size) MOZ_ALLOCATOR;
|
||||
MFBT_API void* moz_xrealloc(void* ptr, size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
MFBT_API char* moz_xstrdup(const char* str) MOZ_ALLOCATOR;
|
||||
MFBT_API char* moz_xstrdup(const char* str) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
#if defined(HAVE_STRNDUP)
|
||||
MFBT_API char* moz_xstrndup(const char* str, size_t strsize) MOZ_ALLOCATOR;
|
||||
MFBT_API char* moz_xstrndup(const char* str,
|
||||
size_t strsize) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
#endif /* if defined(HAVE_STRNDUP) */
|
||||
|
||||
MFBT_API void* moz_xmemdup(const void* ptr, size_t size) MOZ_ALLOCATOR;
|
||||
MFBT_API void* moz_xmemdup(const void* ptr,
|
||||
size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
MFBT_API void* moz_xmemalign(size_t boundary, size_t size) MOZ_ALLOCATOR;
|
||||
MFBT_API void* moz_xmemalign(size_t boundary,
|
||||
size_t size) MOZ_INFALLIBLE_ALLOCATOR;
|
||||
|
||||
MFBT_API size_t moz_malloc_usable_size(void* ptr);
|
||||
|
||||
|
|
|
@ -353,8 +353,11 @@
|
|||
*/
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define MOZ_ALLOCATOR __attribute__((malloc, warn_unused_result))
|
||||
# define MOZ_INFALLIBLE_ALLOCATOR \
|
||||
__attribute__((malloc, warn_unused_result, returns_nonnull))
|
||||
#else
|
||||
# define MOZ_ALLOCATOR
|
||||
# define MOZ_INFALLIBLE_ALLOCATOR
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче