1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00

[globhist] Small rewrite to avoid warnings

This commit is contained in:
Witold Filipczyk 2022-01-30 15:02:44 +01:00
parent ca1bf5c78d
commit 66faddfef9

View File

@ -328,7 +328,6 @@ static void
read_global_history(void) read_global_history(void)
{ {
char in_buffer[MAX_STR_LEN * 3]; char in_buffer[MAX_STR_LEN * 3];
char *file_name = GLOBAL_HISTORY_FILENAME;
char *title; char *title;
FILE *f; FILE *f;
@ -337,12 +336,15 @@ read_global_history(void)
return; return;
if (elinks_home) { if (elinks_home) {
file_name = straconcat(elinks_home, file_name, char *file_name = straconcat(elinks_home, GLOBAL_HISTORY_FILENAME,
(char *) NULL); (char *) NULL);
if (!file_name) return; 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; if (!f) return;
title = in_buffer; title = in_buffer;
@ -391,7 +393,7 @@ write_global_history(void)
if (!ssi) return; if (!ssi) return;
foreachback (history_item, global_history.entries) { 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->title,
history_item->url, history_item->url,
(time_print_T) history_item->last_visit) < 0) (time_print_T) history_item->last_visit) < 0)