mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 19:52:10 +01:00
Merge branch 'master' into 'master'
macros: Double-cast func for g_autolist to avoid warning Closes #1382 and #1390 See merge request GNOME/glib!8
This commit is contained in:
commit
89c6d64a97
@ -482,9 +482,9 @@
|
||||
typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \
|
||||
typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
static inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); } \
|
||||
static inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) func); } \
|
||||
static inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) func); } \
|
||||
static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); } \
|
||||
static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) func); } \
|
||||
static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) func); } \
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
|
@ -1,6 +1,12 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct _HNVC HasNonVoidCleanup;
|
||||
HasNonVoidCleanup * non_void_cleanup (HasNonVoidCleanup *);
|
||||
|
||||
/* Should not cause any warnings with -Wextra */
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(HasNonVoidCleanup, non_void_cleanup)
|
||||
|
||||
static void
|
||||
test_autofree (void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user