[libvirt-glib 1/2] Follow glib conventions for SimpleAsyncResult source tag

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

 



g_simple_async_result_is_valid() API documentation says that the
source tag field for SimpleAsyncResult objects "by convention, is a
pointer to the _async function corresponding to the _finish function from
which this function is called"
The stream functions were already following this convention, but
other places were using the sync function name as the source tag.
This commit uses the async function name everywhere.
---
 libvirt-gobject/libvirt-gobject-connection.c   |   12 ++++++------
 libvirt-gobject/libvirt-gobject-domain.c       |    4 ++--
 libvirt-gobject/libvirt-gobject-storage-pool.c |   12 ++++++------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 483533d..70d1adc 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -478,7 +478,7 @@ void gvir_connection_open_async(GVirConnection *conn,
     res = g_simple_async_result_new(G_OBJECT(conn),
                                     callback,
                                     user_data,
-                                    gvir_connection_open);
+                                    gvir_connection_open_async);
     g_simple_async_result_run_in_thread(res,
                                         gvir_connection_open_helper,
                                         G_PRIORITY_DEFAULT,
@@ -501,7 +501,7 @@ gboolean gvir_connection_open_finish(GVirConnection *conn,
 
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
-        g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_open);
+        g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_open_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
@@ -886,7 +886,7 @@ void gvir_connection_fetch_domains_async(GVirConnection *conn,
     res = g_simple_async_result_new(G_OBJECT(conn),
                                     callback,
                                     user_data,
-                                    gvir_connection_fetch_domains);
+                                    gvir_connection_fetch_domains_async);
     g_simple_async_result_run_in_thread(res,
                                         gvir_connection_fetch_domains_helper,
                                         G_PRIORITY_DEFAULT,
@@ -908,7 +908,7 @@ gboolean gvir_connection_fetch_domains_finish(GVirConnection *conn,
 
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
-        g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_fetch_domains);
+        g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_fetch_domains_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
@@ -947,7 +947,7 @@ void gvir_connection_fetch_storage_pools_async(GVirConnection *conn,
     res = g_simple_async_result_new(G_OBJECT(conn),
                                     callback,
                                     user_data,
-                                    gvir_connection_fetch_storage_pools);
+                                    gvir_connection_fetch_storage_pools_async);
     g_simple_async_result_run_in_thread(res,
                                         gvir_connection_fetch_pools_helper,
                                         G_PRIORITY_DEFAULT,
@@ -970,7 +970,7 @@ gboolean gvir_connection_fetch_storage_pools_finish(GVirConnection *conn,
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
         g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
-                        gvir_connection_fetch_storage_pools);
+                        gvir_connection_fetch_storage_pools_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 9ab6b06..4148a78 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -788,7 +788,7 @@ void gvir_domain_save_async (GVirDomain *dom,
     res = g_simple_async_result_new(G_OBJECT(dom),
                                     callback,
                                     user_data,
-                                    gvir_domain_save);
+                                    gvir_domain_save_async);
     g_simple_async_result_set_op_res_gpointer (res, data, (GDestroyNotify) domain_save_data_free);
     g_simple_async_result_run_in_thread(res,
                                         gvir_domain_save_helper,
@@ -817,7 +817,7 @@ gboolean gvir_domain_save_finish (GVirDomain *dom,
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
         g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
-                        gvir_domain_save);
+                        gvir_domain_save_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index 0ba1768..488f146 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -437,7 +437,7 @@ void gvir_storage_pool_refresh_async(GVirStoragePool *pool,
     res = g_simple_async_result_new(G_OBJECT(pool),
                                     callback,
                                     user_data,
-                                    gvir_storage_pool_refresh);
+                                    gvir_storage_pool_refresh_async);
     g_simple_async_result_run_in_thread(res,
                                         gvir_storage_pool_refresh_helper,
                                         G_PRIORITY_DEFAULT,
@@ -460,7 +460,7 @@ gboolean gvir_storage_pool_refresh_finish(GVirStoragePool *pool,
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
         g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
-                        gvir_storage_pool_refresh);
+                        gvir_storage_pool_refresh_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
@@ -627,7 +627,7 @@ void gvir_storage_pool_build_async (GVirStoragePool *pool,
     res = g_simple_async_result_new(G_OBJECT(pool),
                                     callback,
                                     user_data,
-                                    gvir_storage_pool_build);
+                                    gvir_storage_pool_build_async);
     g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
     g_simple_async_result_run_in_thread(res,
                                         gvir_storage_pool_build_helper,
@@ -654,7 +654,7 @@ gboolean gvir_storage_pool_build_finish(GVirStoragePool *pool,
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
         g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
-                        gvir_storage_pool_build);
+                        gvir_storage_pool_build_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
@@ -727,7 +727,7 @@ void gvir_storage_pool_start_async (GVirStoragePool *pool,
     res = g_simple_async_result_new(G_OBJECT(pool),
                                     callback,
                                     user_data,
-                                    gvir_storage_pool_start);
+                                    gvir_storage_pool_start_async);
     g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
     g_simple_async_result_run_in_thread(res,
                                         gvir_storage_pool_start_helper,
@@ -754,7 +754,7 @@ gboolean gvir_storage_pool_start_finish(GVirStoragePool *pool,
     if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
         GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
         g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
-                        gvir_storage_pool_start);
+                        gvir_storage_pool_start_async);
         if (g_simple_async_result_propagate_error(simple, err))
             return FALSE;
     }
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]