summaryrefslogtreecommitdiffstats
path: root/history.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-10-05 14:10:04 +0800
committerKevin McCarthy <kevin@8t8.us>2019-10-05 14:10:04 +0800
commit43bc959c8e88bf4306b1b5c65e5287d6c40c872c (patch)
tree6bdad84574404f66867a459f61caf3fe7275eb5f /history.c
parentbb62f172e91f15a82f06b53695fc2cd9088d1a00 (diff)
Convert shrink_histfile() tempfile to use buffer pool.
Diffstat (limited to 'history.c')
-rw-r--r--history.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/history.c b/history.c
index 48565fdd..f2dde193 100644
--- a/history.c
+++ b/history.c
@@ -188,7 +188,7 @@ static int dup_hash_inc (HASH *dup_hash, char *s)
static void shrink_histfile (void)
{
- char tmpfname[_POSIX_PATH_MAX];
+ BUFFER *tmpfname = NULL;
FILE *f, *tmp = NULL;
int n[HC_LAST] = { 0 };
int line, hclass, read;
@@ -236,10 +236,11 @@ static void shrink_histfile (void)
if (regen_file)
{
- mutt_mktemp (tmpfname, sizeof (tmpfname));
- if ((tmp = safe_fopen (tmpfname, "w+")) == NULL)
+ tmpfname = mutt_buffer_pool_get ();
+ mutt_buffer_mktemp (tmpfname);
+ if ((tmp = safe_fopen (mutt_b2s (tmpfname), "w+")) == NULL)
{
- mutt_perror (tmpfname);
+ mutt_perror (mutt_b2s (tmpfname));
goto cleanup;
}
rewind (f);
@@ -277,8 +278,9 @@ cleanup:
safe_fclose (&f);
}
safe_fclose (&tmp);
- unlink (tmpfname);
+ unlink (mutt_b2s (tmpfname));
}
+ mutt_buffer_pool_release (&tmpfname);
if (option (OPTHISTREMOVEDUPS))
for (hclass = 0; hclass < HC_LAST; hclass++)
hash_destroy (&dup_hashes[hclass], NULL);