[glib/tls-database] Setup async result args directly on GSimpleAsyncResult



commit 369d23df391f198d460e897129558080f2f95069
Author: Stef Walter <stefw collabora co uk>
Date:   Mon Dec 27 17:42:29 2010 -0600

    Setup async result args directly on GSimpleAsyncResult
    
     * Don't use g_object_get_qdata()

 gio/gtlsdatabase.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/gio/gtlsdatabase.c b/gio/gtlsdatabase.c
index a1c2f03..587c048 100644
--- a/gio/gtlsdatabase.c
+++ b/gio/gtlsdatabase.c
@@ -30,8 +30,6 @@
 
 G_DEFINE_ABSTRACT_TYPE (GTlsDatabase, g_tls_database, G_TYPE_OBJECT);
 
-static GQuark Q_ASYNC_DATA = 0;
-
 static void
 g_tls_database_init (GTlsDatabase *cert)
 {
@@ -60,7 +58,7 @@ async_verify_chain_thread (GSimpleAsyncResult *res,
                            GObject            *object,
                            GCancellable       *cancellable)
 {
-  AsyncVerifyChain *args = g_object_get_qdata (G_OBJECT (res), Q_ASYNC_DATA);
+  AsyncVerifyChain *args = g_simple_async_result_get_op_res_gpointer (res);
   GError *error = NULL;
 
   args->verify_result = g_tls_database_verify_chain (G_TLS_DATABASE (object),
@@ -97,7 +95,7 @@ g_tls_database_real_verify_chain_async (GTlsDatabase           *self,
 
   res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
                                    g_tls_database_real_verify_chain_async);
-  g_object_set_qdata_full (G_OBJECT (res), Q_ASYNC_DATA, args, async_verify_chain_free);
+  g_simple_async_result_set_op_res_gpointer (res, args, async_verify_chain_free);
   g_simple_async_result_run_in_thread (res, async_verify_chain_thread,
                                        G_PRIORITY_DEFAULT, cancellable);
   g_object_unref (res);
@@ -120,7 +118,7 @@ g_tls_database_real_verify_chain_finish (GTlsDatabase          *self,
   if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
     return G_TLS_CERTIFICATE_GENERIC_ERROR;
 
-  args = g_object_get_qdata (G_OBJECT (result), Q_ASYNC_DATA);
+  args = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
   return args->verify_result;
 }
 
@@ -145,7 +143,7 @@ async_lookup_issuer_thread (GSimpleAsyncResult *res,
                             GObject            *object,
                             GCancellable       *cancellable)
 {
-  AsyncLookupIssuer *args = g_object_get_qdata (G_OBJECT (res), Q_ASYNC_DATA);
+  AsyncLookupIssuer *args = g_simple_async_result_get_op_res_gpointer (res);
   GError *error = NULL;
 
   args->issuer = g_tls_database_lookup_issuer (G_TLS_DATABASE (object),
@@ -175,7 +173,7 @@ g_tls_database_real_lookup_issuer_async (GTlsDatabase          *self,
 
   res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
                                    g_tls_database_real_lookup_issuer_async);
-  g_object_set_qdata_full (G_OBJECT (res), Q_ASYNC_DATA, args, async_lookup_issuer_free);
+  g_simple_async_result_set_op_res_gpointer (res, args, async_lookup_issuer_free);
   g_simple_async_result_run_in_thread (res, async_lookup_issuer_thread,
                                        G_PRIORITY_DEFAULT, cancellable);
   g_object_unref (res);
@@ -199,7 +197,7 @@ g_tls_database_real_lookup_issuer_finish (GTlsDatabase          *self,
   if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
     return NULL;
 
-  args = g_object_get_qdata (G_OBJECT (result), Q_ASYNC_DATA);
+  args = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
   issuer = args->issuer;
   args->issuer = NULL;
   return issuer;
@@ -212,8 +210,6 @@ g_tls_database_class_init (GTlsDatabaseClass *klass)
   klass->verify_chain_finish = g_tls_database_real_verify_chain_finish;
   klass->lookup_issuer_async = g_tls_database_real_lookup_issuer_async;
   klass->lookup_issuer_finish = g_tls_database_real_lookup_issuer_finish;
-
-  Q_ASYNC_DATA = g_quark_from_static_string ("GTlsDatabase::AsyncArgs");
 }
 
 GTlsCertificateFlags



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