From: Kevin McCarthy Date: Tue, 8 Oct 2019 05:07:40 +0000 (+0800) Subject: Convert parse_path_(un)list to use buffer pool for path. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49c97808669904302fc7169df01c2c217f130025;p=mutt Convert parse_path_(un)list to use buffer pool for path. Don't use the buf parameter to avoid stretching it out, as it's used for the entire rc parsing, and typically just holds command names. --- diff --git a/init.c b/init.c index 621cd3c1..9938a99a 100644 --- a/init.c +++ b/init.c @@ -965,42 +965,44 @@ static int parse_unlist (BUFFER *buf, BUFFER *s, union pointer_long_t udata, BUF #ifdef USE_SIDEBAR static int parse_path_list (BUFFER *buf, BUFFER *s, union pointer_long_t udata, BUFFER *err) { - char path[_POSIX_PATH_MAX]; + BUFFER *path; LIST **data = udata.p; + path = mutt_buffer_pool_get (); do { - mutt_extract_token (buf, s, 0); - strfcpy (path, buf->data, sizeof (path)); - mutt_expand_path (path, sizeof (path)); - add_to_list (data, path); + mutt_extract_token (path, s, 0); + mutt_buffer_expand_path (path); + add_to_list (data, mutt_b2s (path)); } while (MoreArgs (s)); + mutt_buffer_pool_release (&path); return 0; } static int parse_path_unlist (BUFFER *buf, BUFFER *s, union pointer_long_t udata, BUFFER *err) { - char path[_POSIX_PATH_MAX]; + BUFFER *path; LIST **data = udata.p; + path = mutt_buffer_pool_get (); do { - mutt_extract_token (buf, s, 0); + mutt_extract_token (path, s, 0); /* * Check for deletion of entire list */ - if (mutt_strcmp (buf->data, "*") == 0) + if (mutt_strcmp (mutt_b2s (path), "*") == 0) { mutt_free_list (data); break; } - strfcpy (path, buf->data, sizeof (path)); - mutt_expand_path (path, sizeof (path)); - remove_from_list (data, path); + mutt_buffer_expand_path (path); + remove_from_list (data, mutt_b2s (path)); } while (MoreArgs (s)); + mutt_buffer_pool_release (&path); return 0; }