Add some comments appropriately for lcov 63/206363/3 accepted/tizen/unified/20190520.084037 submit/tizen/20190517.080001
authorhyunuktak <hyunuk.tak@samsung.com>
Fri, 17 May 2019 04:31:47 +0000 (13:31 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 17 May 2019 07:54:39 +0000 (07:54 +0000)
Change-Id: Ie390970ac4acde8962fe97ca965afc38c9c0e9ce
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/capi-network-stc.spec
src/internal/stc-dbus.c
src/internal/stc-private.c
src/stc-info.c
src/stc-manager.c
src/stc-statistics.c
src/stc.c

index 2c8cce03b424aff839863ed4861433bb0a3de54b..3c77ff46a30b5a435e45ea51fc4a7636d842ca30 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-network-stc
 Summary:    A Smart Traffic Control (STC) libraries in Native API
-Version:    0.0.38
+Version:    0.0.39
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
index eaca0c473746f6695e0880a78643cb0849be9edc..156507d6928bc4f33caa8e576494283c3b45b58c 100755 (executable)
@@ -70,7 +70,7 @@ int _stc_dbus_create(stc_h stc)
 
        stc_handle->dbus_connection.connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (stc_handle->dbus_connection.connection == NULL) {
-               if (err != NULL) {
+               if (err != NULL) { //LCOV_EXCL_LINE
                        STC_LOGE("Failed to connect to the D-BUS daemon [%s]", err->message); //LCOV_EXCL_LINE
                        g_error_free(err); //LCOV_EXCL_LINE
                }
@@ -102,7 +102,7 @@ void _stc_dbus_dictionary_foreach(GVariantIter *iter,
        GVariant *value = NULL;
 
        if (!cb)
-               return;
+               return; //LCOV_EXCL_LINE
 
        while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
                /* STC_DEBUG_GDBUS_KEY_VALUE(key, value); */
@@ -135,7 +135,7 @@ GVariant *_stc_dbus_invoke_method(stc_h stc,
                        &error);
 
        if (reply == NULL) {
-               if (error != NULL) {
+               if (error != NULL) { //LCOV_EXCL_LINE
                        STC_LOGE("g_dbus_connection_call_sync() failed " //LCOV_EXCL_LINE
                                "error [%d: %s]", error->code, error->message);
                        *dbus_error = _stc_convert_error_string_to_enum(error->message); //LCOV_EXCL_LINE
index da3899ff8276e0ee7fcaea9fb2b27a6ca21f152f..d2c0a9e6afb5164bc9a0d482537346d98d4fee79 100755 (executable)
@@ -425,10 +425,10 @@ static void __stc_call_callback(stc_event_e event, stc_error_e error,
 
                                g_slist_free_full(info_data, g_free);
                        } else {
-                               ((stc_stats_info_cb)user_callback)(error, NULL, NULL);
+                               ((stc_stats_info_cb)user_callback)(error, NULL, NULL); //LCOV_EXCL_LINE
                        }
                } else {
-                       ((stc_stats_info_cb)user_callback)(error, NULL, NULL);
+                       ((stc_stats_info_cb)user_callback)(error, NULL, NULL); //LCOV_EXCL_LINE
                }
                break;
        case STC_EVENT_STATS_GET_ALL_RSP:
@@ -439,12 +439,13 @@ static void __stc_call_callback(stc_event_e event, stc_error_e error,
 
                                g_slist_free_full(info_data, g_free);
                        } else {
-                               ((stc_get_all_stats_finished_cb)user_callback)(error, NULL, NULL);
+                               ((stc_get_all_stats_finished_cb)user_callback)(error, NULL, NULL); //LCOV_EXCL_LINE
                        }
                } else {
-                       ((stc_get_all_stats_finished_cb)user_callback)(error, NULL, NULL);
+                       ((stc_get_all_stats_finished_cb)user_callback)(error, NULL, NULL); //LCOV_EXCL_LINE
                }
                break;
+       //LCOV_EXCL_START
        case STC_EVENT_RESTRICTION_GET_RSP:
        case STC_EVENT_RESTRICTION_GET_ALL_RSP:
                if (error == STC_ERROR_NONE) {
@@ -509,6 +510,7 @@ static void __stc_call_callback(stc_event_e event, stc_error_e error,
                        g_free(info_data);
                }
                break;
+       //LCOV_EXCL_STOP
        default:
                break;
        }
@@ -561,6 +563,7 @@ static void __stc_event_cb(stc_event_info_s *event_info, void *user_data)
                        handle->stats_total_user_data = NULL;
                }
                break;
+       //LCOV_EXCL_START
        case STC_EVENT_RESTRICTION_GET_RSP:
                if (handle->restriction_cb) {
                        __stc_call_callback(event_info->event, event_info->error,
@@ -591,7 +594,6 @@ static void __stc_event_cb(stc_event_info_s *event_info, void *user_data)
                        handle->pcap_info_user_data = NULL;
                }
                break;
-       //LCOV_EXCL_START
        case STC_EVENT_WARN_THRESHOLD_CROSSED_RSP:
                if (handle->warn_crossed_cb) {
                        __stc_call_callback(event_info->event, STC_ERROR_NONE,
index 140144de3214788956975dbf66b95cfc8f34e88b..f4cb5d42981425668f8c2e560abaf01d15eafa9a 100755 (executable)
@@ -73,8 +73,8 @@ EXPORT_API int stc_stats_info_clone(stc_stats_info_h info, stc_stats_info_h *clo
 
        stc_stats_info_s *stats_info = MALLOC0(stc_stats_info_s, 1);
        if (!stats_info) {
-               STC_LOGE("Memory allocation failed");
-               return STC_ERROR_OUT_OF_MEMORY;
+               STC_LOGE("Memory allocation failed"); //LCOV_EXCL_LINE
+               return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
        stc_stats_info_s *origin_info = (stc_stats_info_s *)info;
index 2a9742a1d3a6c2267b0a4c2bb31bd47725c9388e..969c1da627937c5aaabf1529ac6b2c8e27e96dc4 100755 (executable)
@@ -195,7 +195,7 @@ EXPORT_API int stc_get_stats(stc_h stc, stc_stats_rule_h rule,
 
        if (info_cb == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -203,7 +203,7 @@ EXPORT_API int stc_get_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Invalid stats rule [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -214,7 +214,7 @@ EXPORT_API int stc_get_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Failed to request stats info [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -239,7 +239,7 @@ EXPORT_API int stc_foreach_stats(stc_h stc, stc_stats_rule_h rule,
 
        if (info_cb == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -247,7 +247,7 @@ EXPORT_API int stc_foreach_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Invalid stats rule [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -258,7 +258,7 @@ EXPORT_API int stc_foreach_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Failed to request stats all info [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -283,7 +283,7 @@ int stc_get_all_stats(stc_h stc, stc_stats_rule_h rule,
 
        if (finished_cb == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -291,7 +291,7 @@ int stc_get_all_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Invalid stats rule [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -301,7 +301,7 @@ int stc_get_all_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Failed to request stats all info [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -320,7 +320,7 @@ int stc_foreach_all_stats(stc_all_stats_info_h info,
 
        if (info_cb == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -328,8 +328,8 @@ int stc_foreach_all_stats(stc_all_stats_info_h info,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Failed to get all stats info [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
-               return ret;
+               STC_UNLOCK; //LCOV_EXCL_LINE
+               return ret; //LCOV_EXCL_LINE
        }
 
        STC_UNLOCK;
@@ -353,7 +353,7 @@ EXPORT_API int stc_get_total_stats(stc_h stc, stc_stats_rule_h rule,
 
        if (info_cb == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -361,7 +361,7 @@ EXPORT_API int stc_get_total_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Invalid stats rule [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
@@ -372,7 +372,7 @@ EXPORT_API int stc_get_total_stats(stc_h stc, stc_stats_rule_h rule,
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Failed to request stats total info [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }
 
index 3235b752213cfcf040fb89e366b69295d481db83..41234e0f0b7bbcd7797937cf3c1bf30c818ed86e 100755 (executable)
@@ -128,13 +128,13 @@ static void __stc_stats_get_all_make_params(
                g_variant_new_uint64(stats_rule->interval.to));
 
        if (stats_rule->iface_type != STC_IFACE_UNKNOWN) {
-               g_variant_builder_add(builder, "{sv}",
+               g_variant_builder_add(builder, "{sv}", //LCOV_EXCL_LINE
                        STC_STATS_RULE_IFTYPE,
                        g_variant_new_uint16(stats_rule->iface_type));
        }
 
        if (stats_rule->time_period != STC_TIME_PERIOD_UNKNOWN) {
-               g_variant_builder_add(builder, "{sv}",
+               g_variant_builder_add(builder, "{sv}", //LCOV_EXCL_LINE
                        STC_STATS_RULE_TIME_PERIOD,
                        g_variant_new_int32(stats_rule->time_period));
        }
@@ -161,13 +161,13 @@ static void __stc_stats_get_total_make_params(
                g_variant_new_uint64(stats_rule->interval.to));
 
        if (stats_rule->iface_type != STC_IFACE_UNKNOWN) {
-               g_variant_builder_add(builder, "{sv}",
+               g_variant_builder_add(builder, "{sv}", //LCOV_EXCL_LINE
                        STC_STATS_RULE_IFTYPE,
                        g_variant_new_uint16(stats_rule->iface_type));
        }
 
        if (stats_rule->time_period != STC_TIME_PERIOD_UNKNOWN) {
-               g_variant_builder_add(builder, "{sv}",
+               g_variant_builder_add(builder, "{sv}", //LCOV_EXCL_LINE
                        STC_STATS_RULE_TIME_PERIOD,
                        g_variant_new_int32(stats_rule->time_period));
        }
@@ -358,8 +358,8 @@ static void __stc_stats_foreach_reply(
        conn = G_DBUS_CONNECTION(source_object);
        dbus_data = g_dbus_connection_call_finish(conn, res, &dbus_error);
        if (dbus_error != NULL) {
-               error = _stc_convert_error_string_to_enum(dbus_error->message);
-               g_error_free(dbus_error);
+               error = _stc_convert_error_string_to_enum(dbus_error->message); //LCOV_EXCL_LINE
+               g_error_free(dbus_error); //LCOV_EXCL_LINE
        }
 
        if (_stc_event_get_request_table_state(STC_REQUEST_TABLE_STATS_FOREACH))
@@ -430,8 +430,8 @@ static void __stc_stats_get_all_reply(
        conn = G_DBUS_CONNECTION(source_object);
        dbus_data = g_dbus_connection_call_finish(conn, res, &dbus_error);
        if (dbus_error != NULL) {
-               error = _stc_convert_error_string_to_enum(dbus_error->message);
-               g_error_free(dbus_error);
+               error = _stc_convert_error_string_to_enum(dbus_error->message); //LCOV_EXCL_LINE
+               g_error_free(dbus_error); //LCOV_EXCL_LINE
        }
 
        if (_stc_event_get_request_table_state(STC_REQUEST_TABLE_STATS_GET_ALL))
@@ -763,8 +763,8 @@ stc_error_e _stc_stats_foreach_all(stc_all_stats_info_h info,
        GSList *stats_list = (GSList *)info;
 
        if (g_slist_length(stats_list) == 0) {
-               STC_LOGD("There is no stats info");
-               return STC_ERROR_NONE;
+               STC_LOGD("There is no stats info"); //LCOV_EXCL_LINE
+               return STC_ERROR_NONE; //LCOV_EXCL_LINE
        }
 
        for (list = stats_list; list; list = list->next) {
@@ -830,14 +830,14 @@ EXPORT_API int stc_stats_rule_create(stc_h stc, stc_stats_rule_h *rule)
 
        if (rule == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        stc_stats_rule_s *stats_rule = g_try_malloc0(sizeof(stc_stats_rule_s));
        if (stats_rule == NULL) {
                STC_LOGE("Memory allocation failed"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
@@ -913,7 +913,7 @@ EXPORT_API int stc_stats_rule_set_time_interval(stc_stats_rule_h rule,
 
        if (from < 0 || to < 0) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -954,7 +954,7 @@ EXPORT_API int stc_stats_rule_set_iface_type(
                break;
        default:
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -990,7 +990,7 @@ EXPORT_API int stc_stats_rule_set_time_period(stc_stats_rule_h rule,
                break;
        default:
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -1014,17 +1014,17 @@ EXPORT_API int stc_stats_rule_get_app_id(stc_stats_rule_h rule, char **app_id)
        }
 
        if (app_id == NULL) {
-               STC_LOGE("Invalid parameter");
-               STC_UNLOCK;
-               return STC_ERROR_INVALID_PARAMETER;
+               STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
+               STC_UNLOCK; //LCOV_EXCL_LINE
+               return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        stc_stats_rule_s *stats_rule = (stc_stats_rule_s *)rule;
 
        *app_id = g_strdup(stats_rule->app_id);
        if (*app_id == NULL) {
-               STC_UNLOCK;
-               return STC_ERROR_OUT_OF_MEMORY;
+               STC_UNLOCK; //LCOV_EXCL_LINE
+               return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
        STC_LOGI("App id [%s]", *app_id);
index a8f4dcf966e4f4f252b9722e6fb77bf0ec7f5544..12efbd29fbf0d5f1ced5eba4180431c5ae7341fb 100755 (executable)
--- a/src/stc.c
+++ b/src/stc.c
@@ -66,7 +66,7 @@ EXPORT_API int stc_initialize(stc_h *stc)
 
        if (stc == NULL) {
                STC_LOGE("Invalid parameter"); //LCOV_EXCL_LINE
-               STC_UNLOCK;
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
@@ -82,9 +82,9 @@ EXPORT_API int stc_initialize(stc_h *stc)
        if (ret != STC_ERROR_NONE) {
                STC_LOGE("Init failed [%s]", //LCOV_EXCL_LINE
                        _stc_convert_error_type_to_string(ret));
-               FREE(*stc);
-               *stc = NULL;
-               STC_UNLOCK;
+               FREE(*stc); //LCOV_EXCL_LINE
+               *stc = NULL; //LCOV_EXCL_LINE
+               STC_UNLOCK; //LCOV_EXCL_LINE
                return ret; //LCOV_EXCL_LINE
        }