about summary refs log tree commit diff stats
path: root/src/tools/autocomplete.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/autocomplete.c')
-rw-r--r--src/tools/autocomplete.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c
index 9a809984..e1efdba9 100644
--- a/src/tools/autocomplete.c
+++ b/src/tools/autocomplete.c
@@ -35,7 +35,6 @@
 
 #include "config.h"
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -315,11 +314,13 @@ _autocomplete_param_common(const char* const input, char* command, autocomplete_
     char* result = NULL;
     int len;
 
-    len = asprintf(&command_cpy, "%s ", command);
-    if (len == -1) {
+    command_cpy = g_strdup_printf("%s ", command);
+    if (!command_cpy) {
         return NULL;
     }
 
+    len = strlen(command_cpy);
+
     if (strncmp(input, command_cpy, len) == 0) {
         int inp_len = strlen(input);
         char prefix[inp_len];