diff options
author | Dan Winship <danw@gnome.org> | 2012-05-10 11:09:52 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-07-10 10:49:20 -0400 |
commit | 82d914d808c616d14d489c0272c6d5afc4bfbd5a (patch) | |
tree | 9b9d416fe6a2374d433a1201a51439c53cbbc91e /gio/gfileenumerator.c | |
parent | f8532a13e2054e649f75ca2a58e01604be05549e (diff) | |
download | glib-82d914d808c616d14d489c0272c6d5afc4bfbd5a.tar.gz |
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
Diffstat (limited to 'gio/gfileenumerator.c')
-rw-r--r-- | gio/gfileenumerator.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/gio/gfileenumerator.c b/gio/gfileenumerator.c index b4f742463..a6db242fa 100644 --- a/gio/gfileenumerator.c +++ b/gio/gfileenumerator.c @@ -400,21 +400,16 @@ g_file_enumerator_next_files_finish (GFileEnumerator *enumerator, GError **error) { GFileEnumeratorClass *class; - GSimpleAsyncResult *simple; g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), NULL); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL); if (g_async_result_legacy_propagate_error (result, error)) return NULL; - - if (G_IS_SIMPLE_ASYNC_RESULT (result)) - { - simple = G_SIMPLE_ASYNC_RESULT (result); - + else if (g_async_result_is_tagged (result, g_file_enumerator_next_files_async)) + { /* Special case read of 0 files */ - if (g_simple_async_result_get_source_tag (simple) == g_file_enumerator_next_files_async) - return NULL; + return NULL; } class = G_FILE_ENUMERATOR_GET_CLASS (enumerator); |