[evolution-data-server] Prefer g_simple_async_result_take_error().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Prefer g_simple_async_result_take_error().
- Date: Thu, 6 Oct 2011 13:51:15 +0000 (UTC)
commit 9d42db91bde8ccad168e8f8d163bb77b4f2b1944
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Oct 6 09:50:28 2011 -0400
Prefer g_simple_async_result_take_error().
Slightly more efficient and convenient than:
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);
One less GError to copy and destroy.
camel/camel-cipher-context.c | 36 +++++++--------------
camel/camel-data-wrapper.c | 18 +++-------
camel/camel-folder.c | 48 +++++++++------------------
camel/camel-mime-part.c | 6 +--
camel/camel-offline-folder.c | 6 +--
camel/camel-sasl.c | 18 +++-------
camel/camel-service.c | 6 +--
camel/camel-session.c | 6 +--
camel/camel-store.c | 60 +++++++++++-----------------------
camel/camel-subscribable.c | 12 ++-----
camel/camel-transport.c | 6 +--
libedataserverui/e-book-auth-util.c | 18 +++-------
12 files changed, 80 insertions(+), 160 deletions(-)
---
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index e684a65..6cf839b 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -288,10 +288,8 @@ cipher_context_sign_thread (GSimpleAsyncResult *simple,
async_context->ipart, async_context->opart,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -357,10 +355,8 @@ cipher_context_verify_thread (GSimpleAsyncResult *simple,
CAMEL_CIPHER_CONTEXT (object), async_context->ipart,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -432,10 +428,8 @@ cipher_context_encrypt_thread (GSimpleAsyncResult *simple,
async_context->ipart, async_context->opart,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -509,10 +503,8 @@ cipher_context_decrypt_thread (GSimpleAsyncResult *simple,
CAMEL_CIPHER_CONTEXT (object), async_context->ipart,
async_context->opart, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -584,10 +576,8 @@ cipher_context_import_keys_thread (GSimpleAsyncResult *simple,
CAMEL_CIPHER_CONTEXT (object), async_context->stream,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -650,10 +640,8 @@ cipher_context_export_keys_thread (GSimpleAsyncResult *simple,
CAMEL_CIPHER_CONTEXT (object), async_context->strings,
async_context->stream, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index f640f96..1dee432 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -279,10 +279,8 @@ data_wrapper_write_to_stream_thread (GSimpleAsyncResult *simple,
async_context->stream,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -351,10 +349,8 @@ data_wrapper_decode_to_stream_thread (GSimpleAsyncResult *simple,
async_context->stream,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -421,10 +417,8 @@ data_wrapper_construct_from_stream_thread (GSimpleAsyncResult *simple,
CAMEL_DATA_WRAPPER (object), async_context->stream,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 1f0d396..549f15e 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -952,10 +952,8 @@ folder_append_message_thread (GSimpleAsyncResult *simple,
async_context->info, &async_context->message_uid,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1023,10 +1021,8 @@ folder_expunge_thread (GSimpleAsyncResult *simple,
camel_folder_expunge_sync (
CAMEL_FOLDER (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1078,10 +1074,8 @@ folder_get_message_thread (GSimpleAsyncResult *simple,
CAMEL_FOLDER (object), async_context->message_uid,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1144,10 +1138,8 @@ folder_get_quota_info_thread (GSimpleAsyncResult *simple,
async_context->quota_info = camel_folder_get_quota_info_sync (
CAMEL_FOLDER (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static CamelFolderQuotaInfo *
@@ -1224,10 +1216,8 @@ folder_refresh_info_thread (GSimpleAsyncResult *simple,
camel_folder_refresh_info_sync (
CAMEL_FOLDER (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1279,10 +1269,8 @@ folder_synchronize_thread (GSimpleAsyncResult *simple,
CAMEL_FOLDER (object), async_context->expunge,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1342,10 +1330,8 @@ folder_synchronize_message_thread (GSimpleAsyncResult *simple,
CAMEL_FOLDER (object), async_context->message_uid,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1409,10 +1395,8 @@ folder_transfer_messages_to_thread (GSimpleAsyncResult *simple,
async_context->destination, async_context->delete_originals,
&async_context->transferred_uids, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index d81a29f..80261e1 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -788,10 +788,8 @@ mime_part_construct_from_parser_thread (GSimpleAsyncResult *simple,
CAMEL_MIME_PART (object), async_context->parser,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-offline-folder.c b/camel/camel-offline-folder.c
index a993ad5..1190b7e 100644
--- a/camel/camel-offline-folder.c
+++ b/camel/camel-offline-folder.c
@@ -250,10 +250,8 @@ offline_folder_downsync_thread (GSimpleAsyncResult *simple,
CAMEL_OFFLINE_FOLDER (object), async_context->expression,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c
index e75d738..c0e4170 100644
--- a/camel/camel-sasl.c
+++ b/camel/camel-sasl.c
@@ -299,10 +299,8 @@ sasl_challenge_thread (GSimpleAsyncResult *simple,
CAMEL_SASL (object), async_context->token,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -370,10 +368,8 @@ sasl_try_empty_password_thread (GSimpleAsyncResult *simple,
CAMEL_SASL (object), cancellable, &error);
g_simple_async_result_set_op_res_gboolean (simple, res);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -869,10 +865,8 @@ sasl_challenge_base64_thread (GSimpleAsyncResult *simple,
CAMEL_SASL (object), async_context->base64_token,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
/**
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 2163656..f905b38 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -462,10 +462,8 @@ service_query_auth_types_thread (GSimpleAsyncResult *simple,
async_context->auth_types = camel_service_query_auth_types_sync (
CAMEL_SERVICE (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-session.c b/camel/camel-session.c
index bfa5e18..93284d0 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -148,10 +148,8 @@ session_do_job_cb (GSimpleAsyncResult *simple,
session, cancellable,
job_data->user_data, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static gboolean
diff --git a/camel/camel-store.c b/camel/camel-store.c
index bf9a22a..85c4f1b 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -429,10 +429,8 @@ store_get_folder_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->folder_name_1,
async_context->flags, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -498,10 +496,8 @@ store_get_folder_info_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->folder_name_1,
async_context->flags, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -572,10 +568,8 @@ store_get_inbox_folder_thread (GSimpleAsyncResult *simple,
async_context->folder = camel_store_get_inbox_folder_sync (
CAMEL_STORE (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -638,10 +632,8 @@ store_get_junk_folder_thread (GSimpleAsyncResult *simple,
async_context->folder = camel_store_get_junk_folder_sync (
CAMEL_STORE (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -704,10 +696,8 @@ store_get_trash_folder_thread (GSimpleAsyncResult *simple,
async_context->folder = camel_store_get_trash_folder_sync (
CAMEL_STORE (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -771,10 +761,8 @@ store_create_folder_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->folder_name_1,
async_context->folder_name_2, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -844,10 +832,8 @@ store_delete_folder_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->folder_name_1,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -907,10 +893,8 @@ store_rename_folder_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->folder_name_1,
async_context->folder_name_2, cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -972,10 +956,8 @@ store_synchronize_thread (GSimpleAsyncResult *simple,
CAMEL_STORE (object), async_context->expunge,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -1030,10 +1012,8 @@ store_noop_thread (GSimpleAsyncResult *simple,
camel_store_noop_sync (CAMEL_STORE (object), cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c
index 7da1007..b6b16da 100644
--- a/camel/camel-subscribable.c
+++ b/camel/camel-subscribable.c
@@ -140,10 +140,8 @@ subscribable_subscribe_folder_thread (GSimpleAsyncResult *simple,
async_context->folder_name,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
@@ -207,10 +205,8 @@ subscribable_unsubscribe_folder_thread (GSimpleAsyncResult *simple,
async_context->folder_name,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index df31dda..5da6356 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -90,10 +90,8 @@ transport_send_to_thread (GSimpleAsyncResult *simple,
async_context->from, async_context->recipients,
cancellable, &error);
- if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
}
static void
diff --git a/libedataserverui/e-book-auth-util.c b/libedataserverui/e-book-auth-util.c
index 0dedd26..3a29148 100644
--- a/libedataserverui/e-book-auth-util.c
+++ b/libedataserverui/e-book-auth-util.c
@@ -455,29 +455,25 @@ load_book_source_thread (GSimpleAsyncResult *simple,
book = e_book_new (source, &error);
if (book == NULL) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
+ g_simple_async_result_take_error (simple, error);
return;
}
if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
- g_simple_async_result_set_from_error (simple, error);
+ g_simple_async_result_take_error (simple, error);
g_object_unref (book);
- g_error_free (error);
return;
}
if (!e_book_open (book, FALSE, &error)) {
- g_simple_async_result_set_from_error (simple, error);
+ g_simple_async_result_take_error (simple, error);
g_object_unref (book);
- g_error_free (error);
return;
}
if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
- g_simple_async_result_set_from_error (simple, error);
+ g_simple_async_result_take_error (simple, error);
g_object_unref (book);
- g_error_free (error);
return;
}
@@ -489,9 +485,8 @@ load_book_source_thread (GSimpleAsyncResult *simple,
prompt:
if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
- g_simple_async_result_set_from_error (simple, error);
+ g_simple_async_result_take_error (simple, error);
g_object_unref (book);
- g_error_free (error);
g_free (password);
return;
}
@@ -531,9 +526,8 @@ prompt:
goto prompt;
} else if (error != NULL) {
- g_simple_async_result_set_from_error (simple, error);
+ g_simple_async_result_take_error (simple, error);
g_object_unref (book);
- g_error_free (error);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]