Skip to contentSkip to conversation

shared/shell: Add bt_shell_cleanup

PATCH Applied Inga Stotland 2 participants 2 messages Mar 22, 2018 – Mar 23, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 shared/shell: Add bt_shell_cleanup

This releases resources used for shell initialization. This is needed as a separate function to enable clean shutdown when an application needs to exit prior to calling bt_shell_run(), e.g., when failing program initialization based on processed command line input options.

---
 src/shared/shell.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
src/shared/shell.c +7 -2
index 10f26264f..33bc0d980 100644
@@ -1001,11 +1001,16 @@ void bt_shell_run(void)
 
 	mainloop_run();
 
+	io_destroy(signal);
+
+	bt_shell_cleanup();
+}
+
+void bt_shell_cleanup(void)
+{
 	bt_shell_release_prompt("");
 	bt_shell_detach();
 
-	io_destroy(signal);
-
 	if (data.envs) {
 		queue_destroy(data.envs, env_destroy);
 		data.envs = NULL;
Signature · 1 line
2.13.6
maintainer Applied
#1 lore raw

Hi Inga,

Quoted 33 lines · Inga Stotland

This releases resources used for shell initialization. This is needed as a separate function to enable clean shutdown when an application needs to exit prior to calling bt_shell_run(), e.g., when failing program initialization based on processed command line input options.

---
 src/shared/shell.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
src/shared/shell.c +7 -3
index 10f26264f..33bc0d980 100644
@@ -1001,11 +1001,16 @@ void bt_shell_run(void)
 
        mainloop_run();
 
+       io_destroy(signal);
+
+       bt_shell_cleanup();
+}
+
+void bt_shell_cleanup(void)
+{
        bt_shell_release_prompt("");
        bt_shell_detach();
 
-       io_destroy(signal);
-
        if (data.envs) {
                queue_destroy(data.envs, env_destroy);
                data.envs = NULL;
--
Quoted 1 line

2.13.6

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz