diff options
author | Pino Toscano <toscano.pino@tiscali.it> | 2015-08-25 23:56:05 +0200 |
---|---|---|
committer | Pino Toscano <toscano.pino@tiscali.it> | 2015-08-25 23:56:05 +0200 |
commit | f2fb74a0f91d3a714e17f14b84b2b431b82d94e8 (patch) | |
tree | 80ff8a65b4da929f61e5864b174e6abfc23d1f4b | |
parent | 692fef57a89cf040c539435ca444c5f9ab58f3d9 (diff) | |
download | appstream-glib-f2fb74a0f91d3a714e17f14b84b2b431b82d94e8.tar.gz |
Introduce _cleanup_free_libc_ cleanup attribute
Much like _cleanup_free_, although using libc's free() instead of
g_free(), and thus usable with stdlib return buffers.
-rw-r--r-- | libappstream-glib/as-cleanup.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libappstream-glib/as-cleanup.h b/libappstream-glib/as-cleanup.h index 4554c44..33c5f99 100644 --- a/libappstream-glib/as-cleanup.h +++ b/libappstream-glib/as-cleanup.h @@ -29,6 +29,8 @@ #include "as-node.h" #include "as-yaml.h" +#include <stdlib.h> + G_BEGIN_DECLS #define GS_DEFINE_CLEANUP_FUNCTION(Type, name, func) \ @@ -76,10 +78,13 @@ GS_DEFINE_CLEANUP_FUNCTION(char**, gs_local_strfreev, g_strfreev) GS_DEFINE_CLEANUP_FUNCTION(GList*, gs_local_free_list, g_list_free) GS_DEFINE_CLEANUP_FUNCTION(void*, gs_local_free, g_free) +GS_DEFINE_CLEANUP_FUNCTION(void*, gs_local_free_libc, free) + #define _cleanup_date_time_unref_ __attribute__ ((cleanup(gs_local_date_time_unref))) #define _cleanup_dir_close_ __attribute__ ((cleanup(gs_local_dir_close))) #define _cleanup_timer_destroy_ __attribute__ ((cleanup(gs_local_destroy_timer))) #define _cleanup_free_ __attribute__ ((cleanup(gs_local_free))) +#define _cleanup_free_libc_ __attribute__ ((cleanup(gs_local_free_libc))) #define _cleanup_checksum_free_ __attribute__ ((cleanup(gs_local_checksum_free))) #define _cleanup_error_free_ __attribute__ ((cleanup(gs_local_free_error))) #define _cleanup_list_free_ __attribute__ ((cleanup(gs_local_free_list))) |