0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

librb: Dress some memory functions with attributes.

This commit is contained in:
Jason Volk 2016-06-23 16:18:05 -07:00
parent 4ad6696403
commit 050e36b369

View file

@ -37,6 +37,11 @@
void rb_outofmemory(void) __attribute__((noreturn));
#ifdef __clang__
__attribute__((malloc, returns_nonnull))
#else
__attribute__((malloc, alloc_size(1), returns_nonnull))
#endif
static inline void *
rb_malloc(size_t size)
{
@ -46,6 +51,11 @@ rb_malloc(size_t size)
return (ret);
}
#ifdef __clang__
__attribute__((returns_nonnull))
#else
__attribute__((alloc_size(2), returns_nonnull))
#endif
static inline void *
rb_realloc(void *x, size_t y)
{
@ -56,6 +66,7 @@ rb_realloc(void *x, size_t y)
return (ret);
}
__attribute__((returns_nonnull))
static inline char *
rb_strndup(const char *x, size_t y)
{
@ -66,6 +77,7 @@ rb_strndup(const char *x, size_t y)
return (ret);
}
__attribute__((returns_nonnull))
static inline char *
rb_strdup(const char *x)
{