gcleanup: Implementation of GCleanupScope and associated macros

Add a new type GCleanupScope that stores a list of things to "clean up"
when g_cleanup_clean() is called.

More importantly, define some macros (G_CLEANUP, etc) that
facilitate conditionally building a per-library/executable cleanup list
if G_DEBUG=cleanup is specified.  The cleanup list is run at destructor
time.

-DG_CLEANUP_SCOPE defines the name of the cleanup list and enables the
feature for a given module.

Concept and initial work: Ryan Lortie <desrt@desrt.ca>

https://bugzilla.gnome.org/show_bug.cgi?id=627423
This commit is contained in:
Stef Walter
2013-11-13 08:54:52 +01:00
parent 21cf219cf6
commit 81a2133a72
10 changed files with 995 additions and 0 deletions

View File

@@ -3241,3 +3241,18 @@ g_hostname_is_ascii_encoded
<SUBSECTION>
g_hostname_is_ip_address
</SECTION>
<SECTION>
<FILE>gcleanup</FILE>
<TITLE>Cleanup</FILE>
G_CLEANUP_SCOPE
G_CLEANUP_DEFINE
G_CLEANUP
G_CLEANUP_IN_PHASE
G_CLEANUP_FUNC
G_CLEANUP_FUNC_IN_PHASE
g_cleanup_is_enabled
g_cleanup_list_push
g_cleanup_list_remove
g_cleanup_list_clean
</SECTION>