diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-06-15 18:18:05 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-06-22 11:36:53 +0100 |
commit | b5c98e0624d4c566af30eb6afd1be7e8678cfc65 (patch) | |
tree | 10fb337ffbf34a35fb8cd4b5a5c94072b304f1b6 | |
parent | 5ad63540a2dafd45815dc43085fbfbf25f77296c (diff) |
Simplify tp_account_manager_create_account_finish()
Coverity called this function out for not using 'simple'; this patch
fixes that, but also makes it much simpler.
(There is actually a macro in Wocky which generalizes this boilerplate.
Maybe we should steal it.)
-rw-r--r-- | telepathy-glib/account-manager.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index 791a056a4..a708ca31b 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -1324,25 +1324,18 @@ tp_account_manager_create_account_finish (TpAccountManager *manager, GAsyncResult *result, GError **error) { - TpAccount *retval; GSimpleAsyncResult *simple; g_return_val_if_fail (TP_IS_ACCOUNT_MANAGER (manager), NULL); - g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL); - - simple = G_SIMPLE_ASYNC_RESULT (result); - - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), - error)) - return NULL; - g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (manager), tp_account_manager_create_account_finish), NULL); - retval = TP_ACCOUNT (g_simple_async_result_get_op_res_gpointer ( - G_SIMPLE_ASYNC_RESULT (result))); + simple = (GSimpleAsyncResult *) result; + + if (g_simple_async_result_propagate_error (simple, error)) + return NULL; - return retval; + return TP_ACCOUNT (g_simple_async_result_get_op_res_gpointer (simple)); } /** |