summaryrefslogtreecommitdiffstats
path: root/help.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-10-05 13:59:57 +0800
committerKevin McCarthy <kevin@8t8.us>2019-10-05 13:59:57 +0800
commitbb62f172e91f15a82f06b53695fc2cd9088d1a00 (patch)
tree00d7df83e83988592513a6f29036aa9e3c119c02 /help.c
parentdafb1f381225625b3d5b7b8e5a4364055d00c9df (diff)
Convert mutt_help() to use buffer for tempfile.
Diffstat (limited to 'help.c')
-rw-r--r--help.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/help.c b/help.c
index 347da1ee..5d1882db 100644
--- a/help.c
+++ b/help.c
@@ -338,13 +338,15 @@ static void dump_unbound (FILE *f,
void mutt_help (int menu)
{
- char t[_POSIX_PATH_MAX];
+ BUFFER *t = NULL;
char buf[SHORT_STRING];
const char *desc;
FILE *f;
const struct binding_t *funcs;
- mutt_mktemp (t, sizeof (t));
+ /* We don't use the buffer pool because of the extended lifetime of t */
+ t = mutt_buffer_new ();
+ mutt_buffer_mktemp (t);
funcs = km_get_table (menu);
desc = mutt_getnamebyvalue (menu, Menus);
@@ -353,10 +355,10 @@ void mutt_help (int menu)
do
{
- if ((f = safe_fopen (t, "w")) == NULL)
+ if ((f = safe_fopen (mutt_b2s (t), "w")) == NULL)
{
- mutt_perror (t);
- return;
+ mutt_perror (mutt_b2s (t));
+ goto cleanup;
}
dump_menu (f, menu);
@@ -377,8 +379,11 @@ void mutt_help (int menu)
snprintf (buf, sizeof (buf), _("Help for %s"), desc);
}
while
- (mutt_do_pager (buf, t,
+ (mutt_do_pager (buf, mutt_b2s (t),
MUTT_PAGER_RETWINCH | MUTT_PAGER_MARKER | MUTT_PAGER_NSKIP | MUTT_PAGER_NOWRAP,
NULL)
== OP_REFORMAT_WINCH);
+
+cleanup:
+ mutt_buffer_free (&t);
}