2
2
* util.c - Source for telepathy-glib utility functions
3
* Copyright (C) 2006-2007 Collabora Ltd. <http://www.collabora.co.uk/>
4
* Copyright (C) 2006-2007 Nokia Corporation
5
* @author Robert McQueen <robert.mcqueen@collabora.co.uk>
3
* Copyright © 2006-2010 Collabora Ltd. <http://www.collabora.co.uk/>
4
* Copyright © 2006-2008 Nokia Corporation
7
6
* This library is free software; you can redistribute it and/or
8
7
* modify it under the terms of the GNU Lesser General Public
1252
1260
g_slice_free (TpWeakRef, self);
1264
* tp_clear_object: (skip)
1265
* @op: (allow-none): a pointer to a variable, struct member etc. holding a
1268
* Set a variable holding a #GObject to %NULL. If it was not already %NULL,
1269
* unref the object it previously pointed to.
1271
* This is exactly equivalent to calling tp_clear_pointer() on @op,
1272
* with @destroy = g_object_unref(). See tp_clear_pointer() for example usage.
1278
* tp_clear_pointer: (skip)
1279
* @pp: (allow-none): a pointer to a variable, struct member etc. holding a
1281
* @destroy: a function to which a gpointer can be passed, to destroy *@pp
1282
* (if calling this macro from C++, explicitly casting the function to
1283
* #GDestroyNotify may be necessary)
1285
* Set a variable holding a pointer to %NULL. If it was not already %NULL,
1286
* unref or destroy the object it previously pointed to with @destroy.
1288
* More precisely, if both @pp and *@pp are non-%NULL, set *@pp to %NULL, then
1289
* call @destroy on the object that *@pp previously pointed to.
1291
* This is analogous to g_clear_error() for non-error objects, but also
1292
* ensures that @pp is already %NULL before the destructor is run.
1294
* Typical usage is something like this:
1298
* TpConnection *conn;
1300
* GHashTable *table;
1307
* tp_clear_object (&foo->conn);
1308
* g_clear_error (&foo->error);
1309
* tp_clear_boxed (G_TYPE_HASH_TABLE, &foo->table);
1310
* tp_clear_pointer (&foo->misc, my_struct_destroy);
1317
* tp_clear_boxed: (skip)
1318
* @gtype: (type GObject.Type): the #GType of *@pp, e.g. %G_TYPE_HASH_TABLE
1319
* @pp: (allow-none): a pointer to a variable, struct member etc. holding a
1322
* Set a variable holding a boxed object to %NULL. If it was not already %NULL,
1323
* destroy the boxed object it previously pointed to, as appropriate for
1326
* More precisely, if both @pp and *@pp are non-%NULL, set *@pp to %NULL, then
1327
* call g_boxed_free() on the object that *@pp previously pointed to.
1329
* This is similar to tp_clear_pointer(); see that function's documentation
1330
* for typical usage.