X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..f67718264c7211c98081fad21a3c555b2770b660:/history.c diff --git a/history.c b/history.c index 2a711ff..6852816 100644 --- a/history.c +++ b/history.c @@ -35,7 +35,7 @@ struct history static struct history History[HC_LAST]; static int OldSize = 0; -#define GET_HISTORY(CLASS) ((CLASS < 0 || CLASS >= HC_LAST) ? NULL : &History[CLASS]) +#define GET_HISTORY(CLASS) ((CLASS >= HC_LAST) ? NULL : &History[CLASS]) static void init_history (struct history *h) { @@ -68,7 +68,7 @@ void mutt_read_histfile (void) if ((f = fopen (HistFile, "r")) == NULL) return; - while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) + while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line, 0)) != NULL) { read = 0; if (sscanf (linebuf, "%d:%n", &hclass, &read) < 1 || read == 0 || @@ -90,7 +90,7 @@ void mutt_read_histfile (void) } } - fclose (f); + safe_fclose (&f); FREE (&linebuf); } @@ -107,7 +107,7 @@ static void shrink_histfile (void) return; line = 0; - while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) + while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line, 0)) != NULL) { if (sscanf (linebuf, "%d", &hclass) < 1 || hclass < 0) { @@ -133,7 +133,7 @@ static void shrink_histfile (void) { rewind (f); line = 0; - while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) + while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line, 0)) != NULL) { if (sscanf (linebuf, "%d", &hclass) < 1 || hclass < 0) { @@ -149,7 +149,7 @@ static void shrink_histfile (void) } cleanup: - fclose (f); + safe_fclose (&f); FREE (&linebuf); if (tmp != NULL) { @@ -158,9 +158,9 @@ cleanup: { rewind (tmp); mutt_copy_stream (tmp, f); - fclose (f); + safe_fclose (&f); } - fclose (tmp); + safe_fclose (&tmp); unlink (tmpfname); } } @@ -196,7 +196,7 @@ static void save_history (history_class_t hclass, const char *s) } fputs ("|\n", f); - fclose (f); + safe_fclose (&f); FREE (&tmp); if (--n < 0)