From: Richard Russon Date: Tue, 2 Oct 2018 02:00:45 +0000 (+0100) Subject: use mutt_buffer_strcpy X-Git-Tag: 2019-10-25~607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b392866a78fc495830b65d4077bc74ed8628d6ec;p=neomutt use mutt_buffer_strcpy --- diff --git a/color.c b/color.c index 1f95a25c3..4420bed00 100644 --- a/color.c +++ b/color.c @@ -1032,7 +1032,7 @@ static int parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err, * a rc file. */ { - mutt_str_strfcpy(err->data, _("default colors not supported"), err->dsize); + mutt_buffer_strcpy(err, _("default colors not supported")); return -1; } #endif /* HAVE_USE_DEFAULT_COLORS */ diff --git a/config/dump.c b/config/dump.c index 4deddf1c0..10fde9d56 100644 --- a/config/dump.c +++ b/config/dump.c @@ -284,8 +284,8 @@ bool dump_config(struct ConfigSet *cs, int style, int flags) (type != DT_QUAD) && !(flags & CS_DUMP_NO_ESCAPING)) { mutt_buffer_reset(tmp); - size_t len = pretty_var(value->data, tmp); - mutt_str_strfcpy(value->data, tmp->data, len + 1); + pretty_var(value->data, tmp); + mutt_buffer_strcpy(value, tmp->data); } } @@ -306,8 +306,8 @@ bool dump_config(struct ConfigSet *cs, int style, int flags) (type != DT_QUAD) && !(flags & CS_DUMP_NO_ESCAPING)) { mutt_buffer_reset(tmp); - size_t len = pretty_var(initial->data, tmp); - mutt_str_strfcpy(initial->data, tmp->data, len + 1); + pretty_var(initial->data, tmp); + mutt_buffer_strcpy(initial, tmp->data); } } } diff --git a/hook.c b/hook.c index 26b719a99..1582c5d05 100644 --- a/hook.c +++ b/hook.c @@ -131,7 +131,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, * common mistake */ if ((*pattern.data == '^') && (!CurrentFolder)) { - mutt_str_strfcpy(err->data, _("current mailbox shortcut '^' is unset"), err->dsize); + mutt_buffer_strcpy(err, _("current mailbox shortcut '^' is unset")); goto error; } @@ -142,7 +142,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, * This is likely a mistake too */ if (!*path && *pattern.data) { - mutt_str_strfcpy(err->data, _("mailbox shortcut expanded to empty regex"), err->dsize); + mutt_buffer_strcpy(err, _("mailbox shortcut expanded to empty regex")); goto error; } @@ -155,7 +155,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, { if (mutt_comp_valid_command(command.data) == 0) { - mutt_str_strfcpy(err->data, _("badly formatted command string"), err->dsize); + mutt_buffer_strcpy(err, _("badly formatted command string")); return -1; } } diff --git a/init.c b/init.c index 4dfad56bf..d3f2dcf05 100644 --- a/init.c +++ b/init.c @@ -541,7 +541,7 @@ static int parse_group_context(struct GroupContext **ctx, struct Buffer *buf, { if (!MoreArgs(s)) { - mutt_str_strfcpy(err->data, _("-group: no group name"), err->dsize); + mutt_buffer_strcpy(err, _("-group: no group name")); goto bail; } @@ -551,7 +551,7 @@ static int parse_group_context(struct GroupContext **ctx, struct Buffer *buf, if (!MoreArgs(s)) { - mutt_str_strfcpy(err->data, _("out of arguments"), err->dsize); + mutt_buffer_strcpy(err, _("out of arguments")); goto bail; } @@ -892,7 +892,7 @@ static int parse_alias(struct Buffer *buf, struct Buffer *s, unsigned long data, if (!MoreArgs(s)) { - mutt_str_strfcpy(err->data, _("alias: no address"), err->dsize); + mutt_buffer_strcpy(err, _("alias: no address")); return -1; } @@ -1007,7 +1007,7 @@ static int parse_attachments(struct Buffer *buf, struct Buffer *s, mutt_extract_token(buf, s, 0); if (!buf->data || *buf->data == '\0') { - mutt_str_strfcpy(err->data, _("attachments: no disposition"), err->dsize); + mutt_buffer_strcpy(err, _("attachments: no disposition")); return -1; } @@ -1048,7 +1048,7 @@ static int parse_attachments(struct Buffer *buf, struct Buffer *s, } else { - mutt_str_strfcpy(err->data, _("attachments: invalid disposition"), err->dsize); + mutt_buffer_strcpy(err, _("attachments: invalid disposition")); return -1; } @@ -1328,7 +1328,7 @@ static int parse_my_hdr(struct Buffer *buf, struct Buffer *s, char *p = strpbrk(buf->data, ": \t"); if (!p || (*p != ':')) { - mutt_str_strfcpy(err->data, _("invalid header field"), err->dsize); + mutt_buffer_strcpy(err, _("invalid header field")); return -1; } keylen = p - buf->data + 1; @@ -1866,9 +1866,9 @@ static int parse_spam_list(struct Buffer *buf, struct Buffer *s, if (!MoreArgs(s)) { if (data == MUTT_SPAM) - mutt_str_strfcpy(err->data, _("spam: no matching pattern"), err->dsize); + mutt_buffer_strcpy(err, _("spam: no matching pattern")); else - mutt_str_strfcpy(err->data, _("nospam: no matching pattern"), err->dsize); + mutt_buffer_strcpy(err, _("nospam: no matching pattern")); return -1; } @@ -1924,7 +1924,7 @@ static int parse_spam_list(struct Buffer *buf, struct Buffer *s, } /* This should not happen. */ - mutt_str_strfcpy(err->data, "This is no good at all.", err->dsize); + mutt_buffer_strcpy(err, "This is no good at all."); return -1; } @@ -2208,7 +2208,7 @@ static int parse_unattachments(struct Buffer *buf, struct Buffer *s, mutt_extract_token(buf, s, 0); if (!buf->data || *buf->data == '\0') { - mutt_str_strfcpy(err->data, _("unattachments: no disposition"), err->dsize); + mutt_buffer_strcpy(err, _("unattachments: no disposition")); return -1; } @@ -2235,7 +2235,7 @@ static int parse_unattachments(struct Buffer *buf, struct Buffer *s, } else { - mutt_str_strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize); + mutt_buffer_strcpy(err, _("unattachments: invalid disposition")); return -1; } @@ -3201,8 +3201,8 @@ int mutt_query_variables(struct ListHead *queries) if ((type != DT_BOOL) && (type != DT_NUMBER) && (type != DT_LONG) && (type != DT_QUAD)) { mutt_buffer_reset(tmp); - size_t len = pretty_var(value->data, tmp); - mutt_str_strfcpy(value->data, tmp->data, len + 1); + pretty_var(value->data, tmp); + mutt_buffer_strcpy(value, tmp->data); } dump_config_neo(Config, he, value, NULL, 0); diff --git a/keymap.c b/keymap.c index 1b1d90da4..b3162c14c 100644 --- a/keymap.c +++ b/keymap.c @@ -1316,7 +1316,7 @@ int mutt_parse_macro(struct Buffer *buf, struct Buffer *s, unsigned long data, /* make sure the macro sequence is not an empty string */ if (!*buf->data) { - mutt_str_strfcpy(err->data, _("macro: empty key sequence"), err->dsize); + mutt_buffer_strcpy(err, _("macro: empty key sequence")); } else { @@ -1364,7 +1364,7 @@ int mutt_parse_exec(struct Buffer *buf, struct Buffer *s, unsigned long data, if (!MoreArgs(s)) { - mutt_str_strfcpy(err->data, _("exec: no arguments"), err->dsize); + mutt_buffer_strcpy(err, _("exec: no arguments")); return -1; } diff --git a/pattern.c b/pattern.c index 36c6e1f69..869591eeb 100644 --- a/pattern.c +++ b/pattern.c @@ -748,7 +748,7 @@ static bool is_context_available(struct Buffer *s, regmatch_t pmatch[], return true; /* Nope. */ - mutt_str_strfcpy(err->data, _("No current message"), err->dsize); + mutt_buffer_strcpy(err, _("No current message")); return false; } @@ -882,7 +882,7 @@ static int eat_range_by_regex(struct Pattern *pat, struct Buffer *s, int kind, { if (!Context->menu) { - mutt_str_strfcpy(err->data, _("No current message"), err->dsize); + mutt_buffer_strcpy(err, _("No current message")); return RANGE_E_CTX; } pat->max = CTX_MSGNO(Context); @@ -911,7 +911,7 @@ static bool eat_message_range(struct Pattern *pat, struct Buffer *s, struct Buff /* We need a Context for pretty much anything. */ if (!Context) { - mutt_str_strfcpy(err->data, _("No Context"), err->dsize); + mutt_buffer_strcpy(err, _("No Context")); return false; } @@ -1480,7 +1480,7 @@ struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer } if (!curlist) { - mutt_str_strfcpy(err->data, _("empty pattern"), err->dsize); + mutt_buffer_strcpy(err, _("empty pattern")); return NULL; } if (curlist->next) diff --git a/score.c b/score.c index a31d4e7cb..3e6092d54 100644 --- a/score.c +++ b/score.c @@ -149,7 +149,7 @@ int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data, if (mutt_str_atoi(pc, &ptr->val) < 0) { FREE(&pattern); - mutt_str_strfcpy(err->data, _("Error: score: invalid number"), err->dsize); + mutt_buffer_strcpy(err, _("Error: score: invalid number")); return -1; } OptNeedRescore = true;