}
/**
- * mutt_buffer_expand_path - Create the canonical path (with regex char escaping)
+ * mutt_buffer_expand_path_regex - Create the canonical path (with regex char escaping)
* @param buf Buffer with path
* @param regex If true, escape any regex characters
*
* @note The path is expanded in-place
*/
-void mutt_buffer_expand_path(struct Buffer *buf, bool regex)
+void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
{
const char *s = NULL;
const char *tail = "";
do
{
recurse = false;
- s = buf->data;
+ s = mutt_b2s(buf);
switch (*s)
{
e->env->to = NULL;
mutt_email_free(&e);
/* Avoid infinite recursion if the resulting folder starts with '@' */
- if (*(p->data) != '@')
+ if (*(mutt_b2s(p)) != '@')
recurse = true;
tail = "";
}
}
- if (regex && *p->data && !recurse)
+ if (regex && *(mutt_b2s(p)) && !recurse)
{
mutt_file_sanitize_regex(q, mutt_b2s(p));
mutt_buffer_printf(tmp, "%s%s", mutt_b2s(q), tail);
#endif
}
+/**
+ * mutt_buffer_expand_path - Create the canonical path
+ * @param buf Buffer with path
+ *
+ * @note The path is expanded in-place
+ */
+void mutt_buffer_expand_path(struct Buffer *buf)
+{
+ mutt_buffer_expand_path_regex(buf, 0);
+}
+
/**
* mutt_expand_path_regex - Create the canonical path (with regex char escaping)
* @param buf Buffer with path
{
struct Buffer *tmp = mutt_buffer_pool_get();
- mutt_buffer_addstr(tmp, buf);
- mutt_buffer_expand_path(tmp, regex);
+ mutt_buffer_addstr(tmp, NONULL(buf));
+ mutt_buffer_expand_path_regex(tmp, regex);
mutt_str_strfcpy(buf, mutt_b2s(tmp), buflen);
mutt_buffer_pool_release(&tmp);
void mutt_adv_mktemp(char *s, size_t l);
void mutt_buffer_adv_mktemp (struct Buffer *buf);
void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
-void mutt_buffer_expand_path(struct Buffer *buf, bool regex);
+void mutt_buffer_expand_path(struct Buffer *buf);
+void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex);
int mutt_check_overwrite(const char *attname, const char *path, char *fname, size_t flen, enum SaveAttach *opt, char **directory);
void mutt_encode_path(char *dest, size_t dlen, const char *src);
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags);