poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pk_cmd_exec: Use pk_str_concat


From: John Darrington
Subject: [PATCH] pk_cmd_exec: Use pk_str_concat
Date: Sun, 19 Apr 2020 14:36:47 +0200

---
 src/pk-cmd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/pk-cmd.c b/src/pk-cmd.c
index d4f05fa4..99a97986 100644
--- a/src/pk-cmd.c
+++ b/src/pk-cmd.c
@@ -638,10 +638,7 @@ pk_cmd_exec (const char *str)
       if (strncmp (ecmd, "defun ", 6) != 0
           && strncmp (ecmd, "defun\t", 6) != 0)
         {
-          size_t len = strlen (cmd);
-          cmd_alloc = xmalloc (len + 2);
-          memcpy (cmd_alloc, cmd, len);
-          memcpy (cmd_alloc + len, ";", 2); /* incl. trailing 0 */
+          cmd_alloc = pk_str_concat (cmd, ";", NULL);
           ecmd = cmd_alloc;
         }
 
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]