Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
glib-autocleanups.h
Go to the documentation of this file.
1/*
2 * Copyright © 2015 Canonical Limited
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 */
21
22#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23#error "Only <glib.h> can be included directly."
24#endif
25
26#ifndef __GI_SCANNER__
27
28static inline void
30{
31 void **pp = (void**)p;
32 g_free (*pp);
33}
34
35static inline void
37{
38 if (string)
39 g_string_free (string, TRUE);
40}
41
42/* Ignore deprecations in case we refer to a type which was added in a more
43 * recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */
45
46/* If adding a cleanup here, please also add a test case to
47 * glib/tests/autoptr.c
48 */
56G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
108
110
111#endif /* __GI_SCANNER__ */
GLIB_AVAILABLE_IN_ALL void g_array_unref(GArray *array)
GLIB_AVAILABLE_IN_ALL void g_byte_array_unref(GByteArray *array)
GLIB_AVAILABLE_IN_ALL void g_ptr_array_unref(GPtrArray *array)
typedefG_BEGIN_DECLS struct _GBytes GBytes
Definition garray.h:38
typedefG_BEGIN_DECLS struct _GAsyncQueue GAsyncQueue
Definition gasyncqueue.h:38
GLIB_AVAILABLE_IN_ALL void g_async_queue_unref(GAsyncQueue *queue)
GLIB_AVAILABLE_IN_ALL void g_bookmark_file_free(GBookmarkFile *bookmark)
struct _GBookmarkFile GBookmarkFile
GLIB_AVAILABLE_IN_ALL void g_bytes_unref(GBytes *bytes)
struct _GChecksum GChecksum
Definition gchecksum.h:57
GLIB_AVAILABLE_IN_ALL void g_checksum_free(GChecksum *checksum)
GLIB_AVAILABLE_IN_ALL void g_date_free(GDate *date)
struct _GDateTime GDateTime
Definition gdatetime.h:122
GLIB_AVAILABLE_IN_ALL void g_date_time_unref(GDateTime *datetime)
typedefG_BEGIN_DECLS struct _GDir GDir
Definition gdir.h:39
GLIB_AVAILABLE_IN_ALL void g_dir_close(GDir *dir)
typedefG_BEGIN_DECLS struct _GHashTable GHashTable
Definition ghash.h:40
GLIB_AVAILABLE_IN_ALL void g_hash_table_unref(GHashTable *hash_table)
GLIB_AVAILABLE_IN_2_30 void g_hmac_unref(GHmac *hmac)
typedefG_BEGIN_DECLS struct _GHmac GHmac
Definition ghmac.h:33
typedefG_BEGIN_DECLS struct _GIOChannel GIOChannel
Definition giochannel.h:43
GLIB_AVAILABLE_IN_ALL void g_io_channel_unref(GIOChannel *channel)
struct _GKeyFile GKeyFile
Definition gkeyfile.h:50
GLIB_AVAILABLE_IN_ALL void g_key_file_unref(GKeyFile *key_file)
static void g_autoptr_cleanup_generic_gfree(void *p)
static void g_autoptr_cleanup_gstring_free(GString *string)
GLIB_AVAILABLE_IN_ALL void g_list_free(GList *list)
typedefG_BEGIN_DECLS struct _GList GList
Definition glist.h:39
#define NULL
Definition gmacros.h:924
#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none)
Definition gmacros.h:1402
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Definition gmacros.h:771
#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)
Definition gmacros.h:1400
#define TRUE
Definition gmacros.h:933
#define G_GNUC_END_IGNORE_DEPRECATIONS
Definition gmacros.h:772
#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func)
Definition gmacros.h:1401
GLIB_AVAILABLE_IN_ALL void g_main_loop_unref(GMainLoop *loop)
struct _GMainContext GMainContext
Definition gmain.h:70
struct _GMainLoop GMainLoop
Definition gmain.h:78
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 void g_main_context_pusher_free(GMainContextPusher *pusher)
Definition gmain.h:661
GLIB_AVAILABLE_IN_ALL void g_main_context_unref(GMainContext *context)
GLIB_AVAILABLE_IN_ALL void g_source_unref(GSource *source)
typedefG_BEGIN_DECLS struct _GMappedFile GMappedFile
Definition gmappedfile.h:34
GLIB_AVAILABLE_IN_ALL void g_mapped_file_unref(GMappedFile *file)
struct _GMarkupParseContext GMarkupParseContext
Definition gmarkup.h:116
GLIB_AVAILABLE_IN_2_36 void g_markup_parse_context_unref(GMarkupParseContext *context)
GLIB_AVAILABLE_IN_ALL void g_free(gpointer mem)
GLIB_AVAILABLE_IN_ALL void g_node_destroy(GNode *root)
typedefG_BEGIN_DECLS struct _GNode GNode
Definition gnode.h:38
GLIB_AVAILABLE_IN_ALL void g_option_context_free(GOptionContext *context)
GLIB_AVAILABLE_IN_2_44 void g_option_group_unref(GOptionGroup *group)
typedefG_BEGIN_DECLS struct _GOptionContext GOptionContext
Definition goption.h:40
struct _GOptionGroup GOptionGroup
Definition goption.h:53
GLIB_AVAILABLE_IN_2_76 void g_path_buf_free(GPathBuf *buf)
GLIB_AVAILABLE_IN_2_76 void g_path_buf_clear(GPathBuf *buf)
typedefG_BEGIN_DECLS struct _GPathBuf GPathBuf
Definition gpathbuf.h:17
typedefG_BEGIN_DECLS struct _GPatternSpec GPatternSpec
Definition gpattern.h:32
GLIB_AVAILABLE_IN_ALL void g_pattern_spec_free(GPatternSpec *pspec)
GLIB_AVAILABLE_IN_ALL void g_queue_free(GQueue *queue)
typedefG_BEGIN_DECLS struct _GQueue GQueue
Definition gqueue.h:38
GLIB_AVAILABLE_IN_ALL void g_queue_clear(GQueue *queue)
typedefG_BEGIN_DECLS struct _GRand GRand
Definition grand.h:38
GLIB_AVAILABLE_IN_ALL void g_rand_free(GRand *rand_)
char GRefString
Definition grefstring.h:57
GLIB_AVAILABLE_IN_2_58 void g_ref_string_release(char *str)
GLIB_AVAILABLE_IN_ALL void g_match_info_unref(GMatchInfo *match_info)
struct _GRegex GRegex
Definition gregex.h:416
GLIB_AVAILABLE_IN_ALL void g_regex_unref(GRegex *regex)
struct _GMatchInfo GMatchInfo
Definition gregex.h:425
typedefG_BEGIN_DECLS struct _GScanner GScanner
Definition gscanner.h:39
GLIB_AVAILABLE_IN_ALL void g_scanner_destroy(GScanner *scanner)
typedefG_BEGIN_DECLS struct _GSequence GSequence
Definition gsequence.h:32
GLIB_AVAILABLE_IN_ALL void g_sequence_free(GSequence *seq)
GLIB_AVAILABLE_IN_ALL void g_slist_free(GSList *list)
typedefG_BEGIN_DECLS struct _GSList GSList
Definition gslist.h:39
GLIB_AVAILABLE_IN_ALL void g_strfreev(gchar **str_array)
gchar ** GStrv
Definition gstrfuncs.h:354
typedefG_BEGIN_DECLS struct _GString GString
Definition gstring.h:43
GLIB_AVAILABLE_IN_ALL gchar * g_string_free(GString *string, gboolean free_segment)
typedefG_BEGIN_DECLS struct _GStringChunk GStringChunk
GLIB_AVAILABLE_IN_ALL void g_string_chunk_free(GStringChunk *chunk)
GLIB_AVAILABLE_IN_2_68 void g_strv_builder_unref(GStrvBuilder *builder)
typedefG_BEGIN_DECLS struct _GStrvBuilder GStrvBuilder
GLIB_AVAILABLE_IN_2_32 void g_cond_clear(GCond *cond)
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 void g_rw_lock_reader_locker_free(GRWLockReaderLocker *locker)
Definition gthread.h:765
GLIB_AVAILABLE_IN_2_32 void g_thread_unref(GThread *thread)
static GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 void g_mutex_locker_free(GMutexLocker *locker)
Definition gthread.h:384
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 void g_rw_lock_writer_locker_free(GRWLockWriterLocker *locker)
Definition gthread.h:667
GLIB_AVAILABLE_IN_2_32 void g_mutex_clear(GMutex *mutex)
void GMutexLocker
Definition gthread.h:316
void GRecMutexLocker
Definition gthread.h:438
void GRWLockReaderLocker
Definition gthread.h:722
void GRWLockWriterLocker
Definition gthread.h:564
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 void g_rec_mutex_locker_free(GRecMutexLocker *locker)
Definition gthread.h:509
GLIB_AVAILABLE_IN_ALL void g_timer_destroy(GTimer *timer)
typedefG_BEGIN_DECLS struct _GTimer GTimer
Definition gtimer.h:42
typedefG_BEGIN_DECLS struct _GTimeZone GTimeZone
Definition gtimezone.h:34
GLIB_AVAILABLE_IN_ALL void g_time_zone_unref(GTimeZone *tz)
GLIB_AVAILABLE_IN_ALL void g_tree_unref(GTree *tree)
typedefG_BEGIN_DECLS struct _GTree GTree
Definition gtree.h:40
GLIB_AVAILABLE_IN_2_66 void g_uri_unref(GUri *uri)
typedefG_BEGIN_DECLS G_GNUC_BEGIN_IGNORE_DEPRECATIONS struct _GUri GUri
Definition guri.h:33
GLIB_AVAILABLE_IN_2_40 void g_variant_dict_unref(GVariantDict *dict)
GLIB_AVAILABLE_IN_2_40 void g_variant_dict_clear(GVariantDict *dict)
typedefG_BEGIN_DECLS struct _GVariant GVariant
Definition gvariant.h:36
GLIB_AVAILABLE_IN_ALL void g_variant_unref(GVariant *value)
GLIB_AVAILABLE_IN_ALL void g_variant_iter_free(GVariantIter *iter)
GLIB_AVAILABLE_IN_ALL void g_variant_builder_unref(GVariantBuilder *builder)
GLIB_AVAILABLE_IN_ALL void g_variant_builder_clear(GVariantBuilder *builder)
GLIB_AVAILABLE_IN_ALL void g_variant_type_free(GVariantType *type)
typedefG_BEGIN_DECLS struct _GVariantType GVariantType
Definition gdate.h:93