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)
{
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 ||
}
}
- fclose (f);
+ safe_fclose (&f);
FREE (&linebuf);
}
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)
{
for(hclass = HC_FIRST; hclass < HC_LAST; hclass++)
if (n[hclass] > SaveHist)
{
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((tmp = safe_fopen (tmpfname, "w+")) == NULL)
mutt_perror (tmpfname);
break;
{
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)
{
}
cleanup:
- fclose (f);
+ safe_fclose (&f);
FREE (&linebuf);
if (tmp != NULL)
{
{
rewind (tmp);
mutt_copy_stream (tmp, f);
- fclose (f);
+ safe_fclose (&f);
}
- fclose (tmp);
+ safe_fclose (&tmp);
unlink (tmpfname);
}
}
}
fputs ("|\n", f);
- fclose (f);
+ safe_fclose (&f);
FREE (&tmp);
if (--n < 0)