[libgovirt] Change ovirt_collection_fetch_finish() return value



commit 81094c6baa8ed45335852247b2695218dccea047
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Oct 7 11:46:42 2013 +0200

    Change ovirt_collection_fetch_finish() return value
    
    Returning TRUE/FALSE to indicate an error is more consistent
    with other _finish() functions. Moreover, if we wanted to return
    an object from the call, a GHashTable would make more sense
    to match what ovirt_collection_get_resources() returns

 govirt/ovirt-collection.c |   15 +++++++--------
 govirt/ovirt-collection.h |    6 +++---
 2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/govirt/ovirt-collection.c b/govirt/ovirt-collection.c
index 287a6b5..3edb73f 100644
--- a/govirt/ovirt-collection.c
+++ b/govirt/ovirt-collection.c
@@ -403,20 +403,19 @@ void ovirt_collection_fetch_async(OvirtCollection *collection,
  * returned list should not be freed nor modified, and can become invalid
  * any time a #OvirtCollection call completes.
  */
-GList *
-ovirt_collection_fetch_finish(OvirtCollection *collection,
-                              GAsyncResult *result,
-                              GError **err)
+gboolean ovirt_collection_fetch_finish(OvirtCollection *collection,
+                                       GAsyncResult *result,
+                                       GError **err)
 {
-    g_return_val_if_fail(OVIRT_IS_COLLECTION(collection), NULL);
+    g_return_val_if_fail(OVIRT_IS_COLLECTION(collection), FALSE);
     g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(collection),
                                                         ovirt_collection_fetch_async),
-                         NULL);
+                         FALSE);
 
     if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
-        return NULL;
+        return FALSE;
 
-    return g_hash_table_get_values(ovirt_collection_get_resources(collection));
+    return g_simple_async_result_get_op_res_gboolean(G_SIMPLE_ASYNC_RESULT(result));
 }
 
 
diff --git a/govirt/ovirt-collection.h b/govirt/ovirt-collection.h
index a025820..b41d269 100644
--- a/govirt/ovirt-collection.h
+++ b/govirt/ovirt-collection.h
@@ -69,9 +69,9 @@ void ovirt_collection_fetch_async(OvirtCollection *collection,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);
-GList *ovirt_collection_fetch_finish(OvirtCollection *collection,
-                                     GAsyncResult *result,
-                                     GError **err);
+gboolean ovirt_collection_fetch_finish(OvirtCollection *collection,
+                                       GAsyncResult *result,
+                                       GError **err);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]