From 1bb6cecee69d5167220a18cc4c125c215784de66 Mon Sep 17 00:00:00 2001 From: William Wennerström Date: Tue, 21 Jul 2020 13:11:50 +0200 Subject: Fix stubs and move some tests to http_common --- src/tools/http_common.c | 28 ++++++++++++---------------- src/tools/http_common.h | 2 -- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/tools/http_common.c b/src/tools/http_common.c index df6f9a64..dfd0aa87 100644 --- a/src/tools/http_common.c +++ b/src/tools/http_common.c @@ -64,35 +64,31 @@ http_basename_from_url(const char* url) } void -http_print_transfer_update(ProfWin* window, char* url, - const char* fmt, ...) +http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...) { va_list args; va_start(args, fmt); - char* msg; - if (vasprintf(&msg, fmt, args) == -1) { - msg = strdup(FALLBACK_MSG); - } + GString* msg = g_string_new(FALLBACK_MSG); + g_string_vprintf(msg, fmt, args); va_end(args); - win_update_entry_message(window, url, msg); - free(msg); + win_update_entry_message(window, url, msg->str); + + g_string_free(msg, TRUE); } void -http_print_transfer(ProfWin* window, char* url, - const char* fmt, ...) +http_print_transfer(ProfWin* window, char* url, const char* fmt, ...) { va_list args; va_start(args, fmt); - char* msg; - if (vasprintf(&msg, fmt, args) == -1) { - msg = strdup(FALLBACK_MSG); - } + GString* msg = g_string_new(FALLBACK_MSG); + g_string_vprintf(msg, fmt, args); va_end(args); - win_print_http_transfer(window, msg, url); - free(msg); + win_print_http_transfer(window, msg->str, url); + + g_string_free(msg, TRUE); } diff --git a/src/tools/http_common.h b/src/tools/http_common.h index 41f16200..3fbc6fcd 100644 --- a/src/tools/http_common.h +++ b/src/tools/http_common.h @@ -36,8 +36,6 @@ #ifndef TOOLS_HTTP_COMMON_H #define TOOLS_HTTP_COMMON_H -#define _GNU_SOURCE 1 - #include "ui/window.h" char* http_basename_from_url(const char* url); -- cgit 1.4.1-2-gfad0 arch'/>
path: root/Makefile
blob: df77b3698b65fa016c2b1f1a76c58c6867231fd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35