diff options
author | Michael Vetter <jubalh@iodoru.org> | 2021-03-30 17:38:13 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2021-03-30 17:38:13 +0200 |
commit | 1ec606540eb0f474f3d968d3566a7c56d778a367 (patch) | |
tree | bfe33ebccfc5f2e020a2bcf4908edbbfcc5791f4 /src/tools/autocomplete.c | |
parent | 3c1e4bac3ae640bc4c451d7d4a1c06146e13a15a (diff) | |
download | profani-tty-1ec606540eb0f474f3d968d3566a7c56d778a367.tar.gz |
Get rid of asprintf and _GNU_SOURCE define
_GNU_SOURCE was even in some files where it was not needed at all (http*). Let's replace asprintf() with g_strdup_printf().
Diffstat (limited to 'src/tools/autocomplete.c')
-rw-r--r-- | src/tools/autocomplete.c | 7 |
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]; |