mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gio: add g_async_result_is_tagged()
Rather than doing a two step first-check-the-GAsyncResult-subtype-then- check-the-tag, add a GAsyncResult-level method so that you can do them both at once, simplifying the code for "short-circuit" async return values where the vmethod never gets called. https://bugzilla.gnome.org/show_bug.cgi?id=661767
This commit is contained in:
@@ -457,11 +457,19 @@ g_simple_async_result_get_source_object (GAsyncResult *res)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_simple_async_result_is_tagged (GAsyncResult *res,
|
||||
gpointer source_tag)
|
||||
{
|
||||
return G_SIMPLE_ASYNC_RESULT (res)->source_tag == source_tag;
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface)
|
||||
{
|
||||
iface->get_user_data = g_simple_async_result_get_user_data;
|
||||
iface->get_source_object = g_simple_async_result_get_source_object;
|
||||
iface->is_tagged = g_simple_async_result_is_tagged;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user