From 068adbecc599d56549a9b00a247fb33efa7f3613 Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 24 Aug 2020 18:45:35 +0530 Subject: [PATCH] Mesh: Convert list variables to global static Change-Id: I3c041db3a82efeacab47c7e80ac2f8afad670fc6 Signed-off-by: Anupam --- src/bluetooth-mesh.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bluetooth-mesh.c b/src/bluetooth-mesh.c index a094737..ba000bc 100644 --- a/src/bluetooth-mesh.c +++ b/src/bluetooth-mesh.c @@ -51,13 +51,13 @@ static bool is_mesh_initialized = false; /**< List of Local handles >*/ -GSList *networks; -GSList *node_list; -GSList *element_list; -GSList *model_list; -GSList *appkey_list; -GSList *netkey_list; -GSList *group_list; +static GSList *networks; +static GSList *node_list; +static GSList *element_list; +static GSList *model_list; +static GSList *appkey_list; +static GSList *netkey_list; +static GSList *group_list; #define BT_CHECK_MESH_SUPPORT() \ @@ -690,7 +690,7 @@ static void __mesh_unload_network_configurations(gpointer data, g_strlcpy(net.name.name, network_s->name, BT_MESH_NETWORK_NAME_STRING_MAX_LEN + 1); - BT_INFO("Mesh: Send Network Unload Request"); + BT_INFO("Mesh: Send Network Unload Request: UUID [%s]", net.uuid); if (BLUETOOTH_ERROR_NONE != bluetooth_mesh_network_unload(&net)) { BT_ERR("Mesh: Failed to Unload Network [%s]", network_s->uuid); @@ -715,9 +715,10 @@ int bt_mesh_deinitialize(void) BT_CHECK_MESH_INIT_STATUS(); int error; - BT_INFO("Mesh: Mesh Deinitialized"); + BT_INFO("Mesh: Mesh Deinitialize"); - BT_INFO("Mesh: Remove each Network configuration"); + BT_INFO("Mesh: Remove All Network: Total Nets [%d]", + g_slist_length(networks)); /* Unload All Network Configurations */ g_slist_foreach(networks, __mesh_unload_network_configurations, @@ -1371,8 +1372,14 @@ int bt_mesh_network_create(bt_mesh_node_h config_client, *network = (bt_mesh_network_h)network_s; /* Save network in list */ + BT_INFO("Mesh: Total networks present in app [%d]", + g_slist_length(networks)); + networks = g_slist_append(networks, network_s); + BT_INFO("Mesh: Total networks present in app: After update [%d]", + g_slist_length(networks)); + /* Clean up memory */ for (int i = 0; i < num_models; i++) g_free(param_model[i]); -- 2.7.4