Mesh: Remove duplicate code 56/243856/2
authorAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 10 Sep 2020 12:50:24 +0000 (18:20 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 11 Sep 2020 05:20:09 +0000 (10:50 +0530)
This patch
- Removes duplicate code
- Fix coding style issues

Change-Id: I21a7b70dd74dadd882dae170fab3f64e66fd26d5
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
bt-api/bt-event-handler.c
bt-oal/bluez_hal/src/bt-hal-mesh-dbus-handler.c
bt-service/services/include/bt-service-mesh-cdb.h
bt-service/services/mesh/bt-service-mesh-cdb.c
bt-service/services/mesh/bt-service-mesh-main.c

index b5dcd89..15b41af 100644 (file)
@@ -677,23 +677,6 @@ static void __bt_mesh_event_filter(GDBusConnection *connection,
                _bt_mesh_event_cb(BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED,
                                result, info,
                                event_info->cb, event_info->user_data);
-       } else if (strcasecmp(signal_name, BT_MESH_NODE_TTL_CONFIGURED) == 0) {
-               int result;
-               GVariant *param = NULL;
-               GArray *dbus_data = NULL;
-               bluetooth_mesh_node_ttl_info_t *info = NULL;
-
-               g_variant_get(parameters, "(iv)", &result, &param);
-               dbus_data = g_array_new(TRUE, TRUE, sizeof(gchar));
-
-               __bt_fill_garray_from_variant(param, dbus_data);
-               g_variant_unref(param);
-
-               info = &g_array_index(dbus_data, bluetooth_mesh_node_ttl_info_t, 0);
-
-               _bt_mesh_event_cb(BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED,
-                               result, info,
-                               event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_MESH_MODEL_SUB_CONF) == 0) {
                int result;
                GVariant *param = NULL;
index 3ffba9a..e9714b5 100644 (file)
@@ -1497,11 +1497,10 @@ static struct l_dbus_message *__mesh_agent_prompt_static_request(
        l = g_slist_find_custom(mesh_apps, net_uuid,
                        __mesh_compare_network_uuid);
 
-       if (l) {
+       if (l)
                app = l->data;
-       } else {
+       else
                ERR("Mesh: app not found");
-       }
 
 
        memset(&ev, 0, sizeof(ev));
index 054c7e7..5d88212 100644 (file)
@@ -54,9 +54,9 @@ void _bt_mesh_conf_free(_bt_mesh_cdb_t *cfg);
 
 bool _bt_mesh_conf_parse_data(void *cfg, int k);
 
-bool _bt_mesh_conf_set_vendor_info(_bt_mesh_cdb_t *cfg,uint16_t unicast,
+bool _bt_mesh_conf_set_vendor_info(_bt_mesh_cdb_t *cfg, uint16_t unicast,
                uint16_t crpl, uint16_t cid, uint16_t vid, uint16_t pid,
-                       int proxy, int relay,int lpn, int frnd);
+                               int proxy, int relay, int lpn, int frnd);
 
 bool _bt_mesh_conf_set_model_info(_bt_mesh_cdb_t *cfg,
                uint16_t unicast, GSList *models);
index 9bb13b0..583c80c 100644 (file)
@@ -1171,7 +1171,7 @@ bool _bt_mesh_conf_get_element_count(_bt_mesh_cdb_t *cfg,
        }
 
        sz = json_object_array_length(jarray);
-       if (sz == 0 ){
+       if (sz == 0{
                BT_ERR("Mesh: Element array length is 0");
                return false;
        }
@@ -1638,11 +1638,10 @@ bool _bt_mesh_conf_delete_model_config_data(_bt_mesh_cdb_t *cfg, uint16_t unicas
                return false;
 
        /* Delete group address */
-       if (!json_object_object_get_ex(jmodel, "sub-addr", &jgroups)) {
+       if (!json_object_object_get_ex(jmodel, "sub-addr", &jgroups))
                return false;
-       }
 
-       if(!__mesh_del_sub_group(jgroups, group_addr))
+       if (!__mesh_del_sub_group(jgroups, group_addr))
                return false;
 
        /* Save */
@@ -1669,17 +1668,15 @@ bool _bt_mesh_conf_delete_all_model_config_data(_bt_mesh_cdb_t *cfg, uint16_t un
        if (!jmodel)
                return false;
 
-       /* Delete all roup address */
-       if (!json_object_object_get_ex(jmodel, "sub-addr", &jgroups)) {
+       /* Delete all group address */
+       if (!json_object_object_get_ex(jmodel, "sub-addr", &jgroups))
                return false;
-       }
 
        sz = json_object_array_length(jgroups);
        BT_INFO("Mesh: Total sub-addr entry present is [%d]", sz);
 
-       for (int i = sz - 1; i >= 0 ; --i) {
+       for (int i = sz - 1; i >= 0 ; --i)
                json_object_array_del_idx(jgroups, i, 1);
-       }
 
        /* Save */
        return  __bt_mesh_save_configruation_file(cfg);
index 4b7fe75..bf44116 100644 (file)
@@ -898,7 +898,7 @@ static gboolean __bt_mesh_launch_timer_expired_cb(gpointer data)
 }
 
 static void __bt_mesh_init_wait_response_timeout(
-                struct l_timeout *timeout, void *user_data)
+       struct l_timeout *timeout, void *user_data)
 {
        int result = BLUETOOTH_ERROR_TIMEOUT;