mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-02 11:56:38 +02:00
Add support for g_auto[s]list(Type)
This lets you do g_autoptr style cleanup of GList that does deep freeing. https://bugzilla.gnome.org/show_bug.cgi?id=791342
This commit is contained in:
56
glib/docs.c
56
glib/docs.c
@@ -2607,6 +2607,62 @@
|
||||
* Since: 2.44
|
||||
*/
|
||||
|
||||
/**
|
||||
* g_autolist:
|
||||
* @TypeName: a supported variable type
|
||||
*
|
||||
* Helper to declare a list variable with automatic deep cleanup.
|
||||
*
|
||||
* The list is deeply freed, in a way appropriate to the specified type, when the
|
||||
* variable goes out of scope. The type must support this.
|
||||
*
|
||||
* This feature is only supported on GCC and clang. This macro is not
|
||||
* defined on other compilers and should not be used in programs that
|
||||
* are intended to be portable to those compilers.
|
||||
*
|
||||
* This is meant to be used to declare lists of a type with a cleanup
|
||||
* function. The type of the variable is a GList *. You
|
||||
* must not add your own '*'.
|
||||
*
|
||||
* This macro can be used to avoid having to do explicit cleanups of
|
||||
* local variables when exiting functions. It often vastly simplifies
|
||||
* handling of error conditions, removing the need for various tricks
|
||||
* such as 'goto out' or repeating of cleanup code. It is also helpful
|
||||
* for non-error cases.
|
||||
*
|
||||
* See also g_autoslist(), g_autoptr() and g_steal_pointer().
|
||||
*
|
||||
* Since: 2.56
|
||||
*/
|
||||
|
||||
/**
|
||||
* g_autoslist:
|
||||
* @TypeName: a supported variable type
|
||||
*
|
||||
* Helper to declare a singly linked list variable with automatic deep cleanup.
|
||||
*
|
||||
* The list is deeply freed, in a way appropriate to the specified type, when the
|
||||
* variable goes out of scope. The type must support this.
|
||||
*
|
||||
* This feature is only supported on GCC and clang. This macro is not
|
||||
* defined on other compilers and should not be used in programs that
|
||||
* are intended to be portable to those compilers.
|
||||
*
|
||||
* This is meant to be used to declare lists of a type with a cleanup
|
||||
* function. The type of the variable is a GSList *. You
|
||||
* must not add your own '*'.
|
||||
*
|
||||
* This macro can be used to avoid having to do explicit cleanups of
|
||||
* local variables when exiting functions. It often vastly simplifies
|
||||
* handling of error conditions, removing the need for various tricks
|
||||
* such as 'goto out' or repeating of cleanup code. It is also helpful
|
||||
* for non-error cases.
|
||||
*
|
||||
* See also g_autolist(), g_autoptr() and g_steal_pointer().
|
||||
*
|
||||
* Since: 2.56
|
||||
*/
|
||||
|
||||
/**
|
||||
* G_DEFINE_AUTOPTR_CLEANUP_FUNC:
|
||||
* @TypeName: a type name to define a g_autoptr() cleanup function for
|
||||
|
Reference in New Issue
Block a user