From 66faddfef99cf81d48640616a35d560c5c50b45a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 30 Jan 2022 15:02:44 +0100 Subject: [PATCH] [globhist] Small rewrite to avoid warnings --- src/globhist/globhist.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/globhist/globhist.c b/src/globhist/globhist.c index b2849f940..157ae6b19 100644 --- a/src/globhist/globhist.c +++ b/src/globhist/globhist.c @@ -328,7 +328,6 @@ static void read_global_history(void) { char in_buffer[MAX_STR_LEN * 3]; - char *file_name = GLOBAL_HISTORY_FILENAME; char *title; FILE *f; @@ -337,12 +336,15 @@ read_global_history(void) return; if (elinks_home) { - file_name = straconcat(elinks_home, file_name, + char *file_name = straconcat(elinks_home, GLOBAL_HISTORY_FILENAME, (char *) NULL); if (!file_name) return; + + f = fopen(file_name, "rb"); + mem_free(file_name); + } else { + f = fopen(GLOBAL_HISTORY_FILENAME, "rb"); } - f = fopen(file_name, "rb"); - if (elinks_home) mem_free(file_name); if (!f) return; title = in_buffer; @@ -391,7 +393,7 @@ write_global_history(void) if (!ssi) return; foreachback (history_item, global_history.entries) { - if (secure_fprintf(ssi, "%s\t%s\t%"TIME_PRINT_FORMAT"\n", + if (secure_fprintf(ssi, "%s\t%s\t%" TIME_PRINT_FORMAT "\n", history_item->title, history_item->url, (time_print_T) history_item->last_visit) < 0)