about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-09-09 09:53:23 +0200
committerMichael Vetter <jubalh@iodoru.org>2021-09-09 09:53:23 +0200
commit1dbe1a33b4a3f9651e90750db367ced914e19b1b (patch)
treec4ca5cf1788a74301828307b0196e473efd93f79
parent8c4ce7a9394b898b01deaed375579b8e36f11923 (diff)
downloadprofani-tty-1dbe1a33b4a3f9651e90750db367ced914e19b1b.tar.gz
cmd_funcs: Use glib function
-rw-r--r--src/command/cmd_funcs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 96b541b8..ad1b3331 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -1651,8 +1651,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
         cons_navigation_help();
     } else {
         char* cmd = args[0];
-        char cmd_with_slash[1 + strlen(cmd) + 1];
-        sprintf(cmd_with_slash, "/%s", cmd);
+        char *cmd_with_slash = g_strdup_printf("/%s", cmd);
 
         Command* command = cmd_get(cmd_with_slash);
         if (command) {
@@ -1666,6 +1665,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
             }
         }
         cons_show("");
+        g_free(cmd_with_slash);
     }
 
     return TRUE;