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().
This commit is contained in:
Michael Vetter
2021-03-30 17:38:13 +02:00
parent 3c1e4bac3a
commit 1ec606540e
12 changed files with 97 additions and 104 deletions

View File

@@ -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];