From: Evan Huus Date: Thu, 25 Apr 2013 22:54:36 +0000 (-0000) Subject: Annotate wmem functions for better compiler warnings and optimization. X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=7d2c6f30004ce23445c268fc8c7035fddac124b4;p=metze%2Fwireshark%2Fwip.git Annotate wmem functions for better compiler warnings and optimization. svn path=/trunk/; revision=49041 --- diff --git a/epan/wmem/wmem_core.h b/epan/wmem/wmem_core.h index f9a0af5c3b..4ce51baba9 100644 --- a/epan/wmem/wmem_core.h +++ b/epan/wmem/wmem_core.h @@ -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 diff --git a/epan/wmem/wmem_slist.h b/epan/wmem/wmem_slist.h index 1221ce69e3..d31da3509a 100644 --- a/epan/wmem/wmem_slist.h +++ b/epan/wmem/wmem_slist.h @@ -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 } diff --git a/epan/wmem/wmem_strbuf.h b/epan/wmem/wmem_strbuf.h index ba1e0791f0..34bb73d1e7 100644 --- a/epan/wmem/wmem_strbuf.h +++ b/epan/wmem/wmem_strbuf.h @@ -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 diff --git a/epan/wmem/wmem_strutl.h b/epan/wmem/wmem_strutl.h index 5063eb7d98..cf412d6bf7 100644 --- a/epan/wmem/wmem_strutl.h +++ b/epan/wmem/wmem_strutl.h @@ -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 }