]> granicus.if.org Git - neomutt/commitdiff
use mutt_buffer_strcpy
authorRichard Russon <rich@flatcap.org>
Tue, 2 Oct 2018 02:00:45 +0000 (03:00 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 11 Oct 2018 18:06:26 +0000 (19:06 +0100)
color.c
config/dump.c
hook.c
init.c
keymap.c
pattern.c
score.c

diff --git a/color.c b/color.c
index 1f95a25c366a26b2aba877729be8e3f8fdd01da5..4420bed00f790ae88249ae5c0a769150bebb0464 100644 (file)
--- 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 */
index 4deddf1c05bfc317956ce2aa6520aa1ac696622d..10fde9d56ab218f01070dbc442442f93fec96833 100644 (file)
@@ -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 26b719a99a6877ac6c218dd422dcc38232de577d..1582c5d0530ba45cef20fe93680443ead9178229 100644 (file)
--- 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 4dfad56bffcffac7199e85c78f8d91384ec76587..d3f2dcf057655d39289fc7d92daf28832ffb6235 100644 (file)
--- 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);
index 1b1d90da424e0137a6d895dd1edc70990a3b9972..b3162c14cc5f5753ee3857b006a3c0f5ba349f9a 100644 (file)
--- 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;
   }
 
index 36c6e1f69494a1c3f1773b31b7558b8f5217c545..869591eebed4da8c3408c68c23d2b3dc24dea284 100644 (file)
--- 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 a31d4e7cbdf82c8b764cc6c3bb82f012667068fc..3e6092d542211877b8ab0db3338b72deba83c7e0 100644 (file)
--- 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;