remove unref function. it is done automatically 68/103068/3
authorJeesun Kim <iamjs.kim@samsung.com>
Thu, 8 Dec 2016 08:03:16 +0000 (17:03 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Thu, 8 Dec 2016 09:53:27 +0000 (18:53 +0900)
Change-Id: I7e1f2c899b6851629842fccd2e1eefb59f063202

client/cal_client_dbus.c
server/cal_server_dbus.c

index 4944702..1ccc010 100644 (file)
@@ -291,8 +291,6 @@ int cal_dbus_insert_record(calendar_h handle, calendar_record_h record, int *out
        GVariant *arg_record = cal_dbus_utils_record_to_gvariant(record);
        cal_dbus_call_insert_record_sync(cal_dbus_object, arg_handle, arg_record,
                        &id, &version, &ret, NULL, &error);
-       g_variant_unref(arg_record);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_insert_record_sync() Fail[%s]", error->message);
@@ -301,6 +299,8 @@ int cal_dbus_insert_record(calendar_h handle, calendar_record_h record, int *out
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_record);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -328,8 +328,6 @@ int cal_dbus_update_record(calendar_h handle, calendar_record_h record)
        GVariant *arg_record = cal_dbus_utils_record_to_gvariant(record);
        cal_dbus_call_update_record_sync(cal_dbus_object, arg_handle, arg_record,
                        &version, &ret, NULL, &error);
-       g_variant_unref(arg_record);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_update_record_sync() Fail[%s]", error->message);
@@ -338,6 +336,8 @@ int cal_dbus_update_record(calendar_h handle, calendar_record_h record)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_record);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -363,7 +363,6 @@ int cal_dbus_delete_record(calendar_h handle, const char *view_uri, int id)
        GVariant *arg_handle = cal_dbus_utils_handle_to_gvariant(handle);
        cal_dbus_call_delete_record_sync(cal_dbus_object, arg_handle, view_uri, id,
                        &version, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_delete_record_sync() Fail[%s]", error->message);
@@ -372,6 +371,7 @@ int cal_dbus_delete_record(calendar_h handle, const char *view_uri, int id)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -398,8 +398,6 @@ int cal_dbus_replace_record(calendar_h handle, calendar_record_h record, int id)
        GVariant *arg_record = cal_dbus_utils_record_to_gvariant(record);
        cal_dbus_call_replace_record_sync(cal_dbus_object, arg_handle, arg_record, id,
                        &version, &ret, NULL, &error);
-       g_variant_unref(arg_record);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_replace_record_sync() Fail[%s]", error->message);
@@ -408,6 +406,8 @@ int cal_dbus_replace_record(calendar_h handle, calendar_record_h record, int id)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_record);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -434,8 +434,6 @@ int cal_dbus_insert_records(calendar_h handle, calendar_list_h list,
        GVariant *arg_ids = NULL;
        cal_dbus_call_insert_records_sync(cal_dbus_object, arg_handle, arg_list,
                        &arg_ids, &count, &version, &ret, NULL, &error);
-       g_variant_unref(arg_list);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_insert_records_sync() Fail[%s]", error->message);
@@ -444,6 +442,9 @@ int cal_dbus_insert_records(calendar_h handle, calendar_list_h list,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_list);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_ids);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -452,7 +453,6 @@ int cal_dbus_insert_records(calendar_h handle, calendar_list_h list,
 
        int *ids = NULL;
        cal_dbus_utils_gvariant_to_ids(arg_ids, count, &ids);
-       g_variant_unref(arg_ids);
 
        if (out_ids)
                *out_ids = ids;
@@ -479,8 +479,6 @@ int cal_dbus_update_records(calendar_h handle, calendar_list_h list)
        GVariant *arg_list = cal_dbus_utils_list_to_gvariant(list);
        cal_dbus_call_update_records_sync(cal_dbus_object, arg_handle, arg_list,
                        &version, &ret, NULL, &error);
-       g_variant_unref(arg_list);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_update_records_sync() Fail[%s]",  error->message);
@@ -489,6 +487,8 @@ int cal_dbus_update_records(calendar_h handle, calendar_list_h list)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_list);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -513,8 +513,6 @@ int cal_dbus_delete_records(calendar_h handle, const char *view_uri, int *ids, i
        GVariant *arg_ids = cal_dbus_utils_ids_to_gvariant(ids, count);
        cal_dbus_call_delete_records_sync(cal_dbus_object, arg_handle, view_uri,
                        arg_ids, count, &version, &ret, NULL, &error);
-       g_variant_unref(arg_ids);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_delete_records_sync() Fail[%s]",  error->message);
@@ -523,6 +521,8 @@ int cal_dbus_delete_records(calendar_h handle, const char *view_uri, int *ids, i
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_ids);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -548,9 +548,6 @@ int cal_dbus_replace_records(calendar_h handle, calendar_list_h list, int *ids,
        GVariant *arg_ids = cal_dbus_utils_ids_to_gvariant(ids, count);
        cal_dbus_call_replace_records_sync(cal_dbus_object, arg_handle, arg_list,
                        arg_ids, count, &version, &ret, NULL, &error);
-       g_variant_unref(arg_list);
-       g_variant_unref(arg_ids);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_replace_records_sync() Fail[%s]",  error->message);
@@ -559,6 +556,9 @@ int cal_dbus_replace_records(calendar_h handle, calendar_list_h list, int *ids,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_list);
+               g_variant_unref(arg_ids);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -583,7 +583,6 @@ int cal_dbus_get_record(calendar_h handle, const char *view_uri, int id,
        GVariant *arg_record = NULL;
        cal_dbus_call_get_record_sync(cal_dbus_object, arg_handle, view_uri, id,
                        &arg_record, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_record_sync() Fail[%s]",  error->message);
@@ -592,11 +591,12 @@ int cal_dbus_get_record(calendar_h handle, const char *view_uri, int id,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_record);
                return ret;
                /* LCOV_EXCL_STOP */
        }
        cal_dbus_utils_gvariant_to_record(arg_record, out_record);
-       g_variant_unref(arg_record);
 
        return ret;
 }
@@ -615,7 +615,6 @@ int cal_dbus_get_all_records(calendar_h handle, const char *view_uri,
        GVariant *arg_list = NULL;
        cal_dbus_call_get_all_records_sync(cal_dbus_object, arg_handle, view_uri,
                        offset, limit, &arg_list, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_all_records_sync() Fail[%s]", error->message);
@@ -624,11 +623,12 @@ int cal_dbus_get_all_records(calendar_h handle, const char *view_uri,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_list);
                return ret;
                /* LCOV_EXCL_STOP */
        }
        cal_dbus_utils_gvariant_to_list(arg_list, out_list);
-       g_variant_unref(arg_list);
 
        if (*out_list)
                calendar_list_first(*out_list);
@@ -651,8 +651,6 @@ int cal_dbus_get_records_with_query(calendar_h handle, calendar_query_h query,
        GVariant *arg_list = NULL;
        cal_dbus_call_get_records_with_query_sync(cal_dbus_object, arg_handle, arg_query,
                        offset, limit, &arg_list, &ret, NULL, &error);
-       g_variant_unref(arg_query);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_records_with_query_sync() Fail[%s]",  error->message);
@@ -661,11 +659,13 @@ int cal_dbus_get_records_with_query(calendar_h handle, calendar_query_h query,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_query);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_list);
                return ret;
                /* LCOV_EXCL_STOP */
        }
        cal_dbus_utils_gvariant_to_list(arg_list, out_list);
-       g_variant_unref(arg_list);
 
        if (*out_list)
                calendar_list_first(*out_list);
@@ -686,7 +686,6 @@ int cal_dbus_get_count(calendar_h handle, const char *view_uri, int *out_count)
        GVariant *arg_handle = cal_dbus_utils_handle_to_gvariant(handle);
        cal_dbus_call_get_count_sync(cal_dbus_object, arg_handle, view_uri,
                        &count, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_count_sync() Fail[%s]",  error->message);
@@ -695,6 +694,7 @@ int cal_dbus_get_count(calendar_h handle, const char *view_uri, int *out_count)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -717,8 +717,6 @@ int cal_dbus_get_count_with_query(calendar_h handle, calendar_query_h query, int
        GVariant *arg_query = cal_dbus_utils_query_to_gvariant(query);
        cal_dbus_call_get_count_with_query_sync(cal_dbus_object, arg_handle, arg_query,
                        &count, &ret, NULL, &error);
-       g_variant_unref(arg_query);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_count_with_query_sync() Fail[%s]",  error->message);
@@ -727,6 +725,8 @@ int cal_dbus_get_count_with_query(calendar_h handle, calendar_query_h query, int
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_query);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -797,7 +797,6 @@ int cal_dbus_get_current_version(calendar_h handle, int *out_version)
        GVariant *arg_handle = cal_dbus_utils_handle_to_gvariant(handle);
        cal_dbus_call_get_current_version_sync(cal_dbus_object, arg_handle,
                        &version, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_current_version_sync() Fail[%s]",  error->message);
@@ -806,6 +805,7 @@ int cal_dbus_get_current_version(calendar_h handle, int *out_version)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -853,7 +853,6 @@ int cal_dbus_get_changes_by_version(calendar_h handle, const char *view_uri,
        GVariant *arg_list = NULL;
        cal_dbus_call_get_changes_by_version_sync(cal_dbus_object, arg_handle, view_uri,
                        book_id, in_version, &arg_list, out_version, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_changes_by_version_sync() Fail[%s]",  error->message);
@@ -862,11 +861,12 @@ int cal_dbus_get_changes_by_version(calendar_h handle, const char *view_uri,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_list);
                return ret;
                /* LCOV_EXCL_STOP */
        }
        cal_dbus_utils_gvariant_to_list(arg_list, out_list);
-       g_variant_unref(arg_list);
 
        if (*out_list)
                calendar_list_first(*out_list);
@@ -889,7 +889,6 @@ int cal_dbus_get_changes_exception_by_version(calendar_h handle, const char *vie
        GVariant *arg_list = NULL;
        cal_dbus_call_get_changes_exception_by_version_sync(cal_dbus_object, arg_handle,
                        view_uri, original_id, version, &arg_list, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_get_changes_exception_by_version_sync() Fail[%s]",  error->message);
@@ -898,13 +897,14 @@ int cal_dbus_get_changes_exception_by_version(calendar_h handle, const char *vie
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_list);
                return ret;
                /* LCOV_EXCL_STOP */
        }
        cal_client_handle_set_version(handle, version);
 
        cal_dbus_utils_gvariant_to_list(arg_list, out_list);
-       g_variant_unref(arg_list);
 
        if (*out_list)
                calendar_list_first(*out_list);
@@ -923,7 +923,6 @@ int cal_dbus_clean_after_sync(calendar_h handle, int book_id, int version)
        GVariant *arg_handle = cal_dbus_utils_handle_to_gvariant(handle);
        cal_dbus_call_clean_after_sync_sync(cal_dbus_object, arg_handle, book_id, version,
                        &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_clean_after_sync_sync() Fail[%s]",  error->message);
@@ -932,6 +931,7 @@ int cal_dbus_clean_after_sync(calendar_h handle, int book_id, int version)
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -956,7 +956,6 @@ int cal_dbus_insert_vcalendars(calendar_h handle, const char *stream,
        GVariant *arg_handle = cal_dbus_utils_handle_to_gvariant(handle);
        cal_dbus_call_insert_vcalendars_sync(cal_dbus_object, arg_handle, stream,
                        &arg_ids, &count, &version, &ret, NULL, &error);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_insert_vcalendars_sync() Fail[%s]",  error->message);
@@ -965,6 +964,8 @@ int cal_dbus_insert_vcalendars(calendar_h handle, const char *stream,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_handle);
+               g_variant_unref(arg_ids);
                return ret;
                /* LCOV_EXCL_STOP */
        }
@@ -972,7 +973,6 @@ int cal_dbus_insert_vcalendars(calendar_h handle, const char *stream,
 
        int *ids = NULL;
        cal_dbus_utils_gvariant_to_ids(arg_ids, count, &ids);
-       g_variant_unref(arg_ids);
 
        if (out_ids)
                *out_ids = ids;
@@ -1002,8 +1002,6 @@ int cal_dbus_replace_vcalendars(calendar_h handle, const char *stream,
        GVariant *arg_ids = cal_dbus_utils_ids_to_gvariant(ids, count);
        cal_dbus_call_replace_vcalendars_sync(cal_dbus_object, arg_handle, stream,
                        arg_ids, count, &ret, &version, NULL, &error);
-       g_variant_unref(arg_ids);
-       g_variant_unref(arg_handle);
        if (error) {
                /* LCOV_EXCL_START */
                ERR("cal_dbus_call_replace_vcalendars_sync Fail[%s]",  error->message);
@@ -1012,6 +1010,8 @@ int cal_dbus_replace_vcalendars(calendar_h handle, const char *stream,
                else
                        ret = CALENDAR_ERROR_IPC;
                g_error_free(error);
+               g_variant_unref(arg_ids);
+               g_variant_unref(arg_handle);
                return ret;
                /* LCOV_EXCL_STOP */
        }
index 965a71c..720f64e 100644 (file)
@@ -239,7 +239,6 @@ static gboolean _handle_insert_records(calDbus *object, GDBusMethodInvocation *i
        cal_dbus_complete_insert_records(object, invocation, arg_ids, count, version, ret);
 
        free(ids);
-       g_variant_unref(arg_ids);
 
        cal_server_ondemand_start();
        return TRUE;
@@ -311,7 +310,6 @@ static gboolean _handle_get_record(calDbus *object, GDBusMethodInvocation *invoc
 
        GVariant *arg_record = cal_dbus_utils_record_to_gvariant(record);
        cal_dbus_complete_get_record(object, invocation, arg_record, ret);
-       g_variant_unref(arg_record);
        calendar_record_destroy(record, true);
 
        cal_server_ondemand_start();
@@ -330,7 +328,6 @@ static gboolean _handle_get_all_records(calDbus *object, GDBusMethodInvocation *
        GVariant *arg_list = cal_dbus_utils_list_to_gvariant(list);
        cal_dbus_complete_get_all_records(object, invocation, arg_list, ret);
        calendar_list_destroy(list, true);
-       g_variant_unref(arg_list);
 
        cal_server_ondemand_start();
        return TRUE;
@@ -349,7 +346,6 @@ static gboolean _handle_get_records_with_query(calDbus *object, GDBusMethodInvoc
 
        GVariant *arg_list = cal_dbus_utils_list_to_gvariant(list);
        cal_dbus_complete_get_records_with_query(object, invocation, arg_list, ret);
-       g_variant_unref(arg_list);
        calendar_list_destroy(list, true);
 
        cal_server_ondemand_start();
@@ -424,7 +420,6 @@ static gboolean _handle_get_changes_by_version(calDbus *object, GDBusMethodInvoc
        GVariant *arg_list = cal_dbus_utils_list_to_gvariant(list);
        cal_dbus_complete_get_changes_by_version(object, invocation, arg_list, out_version, ret);
        calendar_list_destroy(list, true);
-       g_variant_unref(arg_list);
 
        cal_server_ondemand_start();
        return TRUE;
@@ -444,7 +439,6 @@ static gboolean _handle_get_changes_exception_by_version(calDbus *object,
        GVariant *arg_list = cal_dbus_utils_list_to_gvariant(list);
        cal_dbus_complete_get_changes_exception_by_version(object, invocation, arg_list, ret);
        calendar_list_destroy(list, true);
-       g_variant_unref(arg_list);
 
        cal_server_ondemand_start();
        return TRUE;
@@ -476,7 +470,6 @@ static gboolean _handle_insert_vcalendars(calDbus *object, GDBusMethodInvocation
        version = cal_db_util_get_transaction_ver();
        cal_dbus_complete_insert_vcalendars(object, invocation, arg_ids, count, version, ret);
        free(ids);
-       g_variant_unref(arg_ids);
 
        cal_server_ondemand_start();
        return TRUE;