Annotate wmem functions for better compiler warnings and optimization.
authorEvan Huus <eapache@gmail.com>
Thu, 25 Apr 2013 22:54:36 +0000 (22:54 -0000)
committerEvan Huus <eapache@gmail.com>
Thu, 25 Apr 2013 22:54:36 +0000 (22:54 -0000)
svn path=/trunk/; revision=49041

epan/wmem/wmem_core.h
epan/wmem/wmem_slist.h
epan/wmem/wmem_strbuf.h
epan/wmem/wmem_strutl.h

index f9a0af5c3bac282c6e1597e51452447f13722e2d..4ce51baba9c716de81a58522ad7eda9394bdb867 100644 (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
index 1221ce69e330b5cd219fae2e44649621fa4bb9d5..d31da3509ab08c034eb0aea66beca3b0a387d55c 100644 (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
 }
index ba1e0791f0ee50c7eee522201f1e962450a7ece9..34bb73d1e7ae508dde2f6a2a888f0b99df100e51 100644 (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
index 5063eb7d982b39ccde9ce9372c37b157a070204e..cf412d6bf77b279136ac797888643c83b8241bed 100644 (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
 }