diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-03-30 11:21:20 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-03-30 11:21:20 -0700 |
commit | 18cef028ed41d333f14df66fb546772646f39a41 (patch) | |
tree | d57134329dac5330c0d69faa50e05b480f652ff8 /commands.c | |
parent | ae5953a22089a52a378c8dc572ae1e4f9e37f1a0 (diff) |
Convert mutt_pipe_message() to use buffer pool.
Diffstat (limited to 'commands.c')
-rw-r--r-- | commands.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -485,7 +485,7 @@ static void pipe_msg (HEADER *h, FILE *fp, int decode, int print) /* the following code is shared between printing and piping */ -static int _mutt_pipe_message (HEADER *h, char *cmd, +static int _mutt_pipe_message (HEADER *h, const char *cmd, int decode, int print, int split, @@ -600,19 +600,24 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, void mutt_pipe_message (HEADER *h) { - char buffer[LONG_STRING]; + BUFFER *buffer; - buffer[0] = 0; - if (mutt_get_field (_("Pipe to command: "), buffer, sizeof (buffer), MUTT_CMD) - != 0 || !buffer[0]) - return; + buffer = mutt_buffer_pool_get (); + if (mutt_buffer_get_field (_("Pipe to command: "), buffer, MUTT_CMD) != 0) + goto cleanup; - mutt_expand_path (buffer, sizeof (buffer)); - _mutt_pipe_message (h, buffer, + if (!mutt_buffer_len (buffer)) + goto cleanup; + + mutt_buffer_expand_path (buffer); + _mutt_pipe_message (h, mutt_b2s (buffer), option (OPTPIPEDECODE), 0, option (OPTPIPESPLIT), PipeSep); + +cleanup: + mutt_buffer_pool_release (&buffer); } void mutt_print_message (HEADER *h) |