Annotate wmem functions for better compiler warnings and optimization.

svn path=/trunk/; revision=49041
This commit is contained in:
Evan Huus 2013-04-25 22:54:36 +00:00
parent e8fc503c21
commit 7d2c6f3000
4 changed files with 24 additions and 11 deletions

View File

@ -45,13 +45,17 @@ typedef struct _wmem_allocator_t wmem_allocator_t;
WS_DLL_PUBLIC
void *
wmem_alloc(wmem_allocator_t *allocator, const size_t size);
wmem_alloc(wmem_allocator_t *allocator, const size_t size)
G_GNUC_MALLOC;
#define wmem_new(allocator, type) \
((type*)wmem_alloc((allocator), sizeof(type)))
WS_DLL_PUBLIC
void *
wmem_alloc0(wmem_allocator_t *allocator, const size_t size);
wmem_alloc0(wmem_allocator_t *allocator, const size_t size)
G_GNUC_MALLOC;
#define wmem_new0(allocator, type) \
((type*)wmem_alloc0((allocator), sizeof(type)))
@ -61,7 +65,8 @@ wmem_free(wmem_allocator_t *allocator, void *ptr);
WS_DLL_PUBLIC
void *
wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size);
wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size)
G_GNUC_MALLOC;
WS_DLL_PUBLIC
void

View File

@ -67,7 +67,8 @@ wmem_slist_prepend(wmem_slist_t *slist, void *data);
WS_DLL_PUBLIC
wmem_slist_t *
wmem_slist_new(wmem_allocator_t *allocator);
wmem_slist_new(wmem_allocator_t *allocator)
G_GNUC_MALLOC;
#ifdef __cplusplus
}

View File

@ -42,11 +42,13 @@ typedef struct _wmem_strbuf_t wmem_strbuf_t;
WS_DLL_PUBLIC
wmem_strbuf_t *
wmem_strbuf_sized_new(wmem_allocator_t *allocator,
gsize alloc_len, gsize max_len);
gsize alloc_len, gsize max_len)
G_GNUC_MALLOC;
WS_DLL_PUBLIC
wmem_strbuf_t *
wmem_strbuf_new(wmem_allocator_t *allocator, const gchar *str);
wmem_strbuf_new(wmem_allocator_t *allocator, const gchar *str)
G_GNUC_MALLOC;
WS_DLL_PUBLIC
void
@ -54,7 +56,8 @@ wmem_strbuf_append(wmem_strbuf_t *strbuf, const gchar *str);
WS_DLL_PUBLIC
void
wmem_strbuf_append_printf(wmem_strbuf_t *strbuf, const gchar *format, ...);
wmem_strbuf_append_printf(wmem_strbuf_t *strbuf, const gchar *format, ...)
G_GNUC_PRINTF(2, 3);
WS_DLL_PUBLIC
void

View File

@ -36,19 +36,23 @@ extern "C" {
WS_DLL_PUBLIC
gchar *
wmem_strdup(wmem_allocator_t *allocator, const gchar *src);
wmem_strdup(wmem_allocator_t *allocator, const gchar *src)
G_GNUC_MALLOC;
WS_DLL_PUBLIC
gchar *
wmem_strndup(wmem_allocator_t *allocator, const gchar *src, const size_t len);
wmem_strndup(wmem_allocator_t *allocator, const gchar *src, const size_t len)
G_GNUC_MALLOC;
WS_DLL_PUBLIC
gchar *
wmem_strdup_printf(wmem_allocator_t *allocator, const gchar *fmt, ...);
wmem_strdup_printf(wmem_allocator_t *allocator, const gchar *fmt, ...)
G_GNUC_MALLOC G_GNUC_PRINTF(2, 3);
WS_DLL_PUBLIC
gchar *
wmem_strdup_vprintf(wmem_allocator_t *allocator, const gchar *fmt, va_list ap);
wmem_strdup_vprintf(wmem_allocator_t *allocator, const gchar *fmt, va_list ap)
G_GNUC_MALLOC;
#ifdef __cplusplus
}