]> granicus.if.org Git - neomutt/commitdiff
tidy upstream changes
authorRichard Russon <rich@flatcap.org>
Sun, 2 Sep 2018 22:22:11 +0000 (23:22 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 2 Sep 2018 23:45:57 +0000 (00:45 +0100)
compress.c
curs_main.c
mbox/mbox.c
mutt/buffer.c
mutt/file.c
mx.c
pager.c
recvattach.c
recvcmd.c
send.c

index 02e8cce71be699d414c4637356e65974801bd109..8dfd8f3d8f8082527093eed70cc06af8d398e602 100644 (file)
@@ -893,7 +893,9 @@ int mutt_comp_valid_command(const char *cmd)
 }
 
 /**
- * comp_msg_padding_size - Returns the padding between messages.
+ * comp_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval num Number of bytes of padding
  */
 static int comp_msg_padding_size(struct Context *ctx)
 {
index f531463b08750e9b73dcf7bc08a9d1c449c51271..07a6da303b058bfd84bcc86b6b8eadecabf45293 100644 (file)
@@ -1767,7 +1767,7 @@ int mutt_index_menu(void)
         CHECK_ATTACH;
         CHECK_MSGCOUNT;
         CHECK_VISIBLE;
-        ci_send_message (SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR);
+        ci_send_message(SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR);
         menu->redraw = REDRAW_FULL;
         break;
 
index fadc93e83f0773fa8f0c1a0473b24f679f7083ba..71a6e3d360b8e9eebd33a492783f8de4559e7e78 100644 (file)
@@ -604,11 +604,21 @@ static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct He
   return 0;
 }
 
+/**
+ * mbox_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval 1 Always
+ */
 static int mbox_msg_padding_size(struct Context *ctx)
 {
   return 1;
 }
 
+/**
+ * mmdf_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval 10 Always
+ */
 static int mmdf_msg_padding_size(struct Context *ctx)
 {
   return 10;
index 3cb89c21000a6a9436adf2d92693c181e773f629..c0f10bf5dc95b8f2b72c7253576e61f71ccd51bb 100644 (file)
@@ -255,14 +255,21 @@ struct Buffer *mutt_buffer_alloc(size_t size)
   return b;
 }
 
-/* Increases the allocated size of the buffer */
+/**
+ * mutt_buffer_increase_size - Increase the allocated size of a buffer
+ * @param buf      Buffer to change
+ * @param new_size New size
+ */
 void mutt_buffer_increase_size(struct Buffer *buf, size_t new_size)
 {
-  if (new_size > buf->dsize)
-  {
-    size_t offset = buf->dptr - buf->data;
-    buf->dsize = new_size;
-    mutt_mem_realloc(&buf->data, buf->dsize);
-    buf->dptr = buf->data + offset;
-  }
+  if (!buf)
+    return;
+
+  if (new_size <= buf->dsize)
+    return;
+
+  size_t offset = buf->dptr - buf->data;
+  buf->dsize = new_size;
+  mutt_mem_realloc(&buf->data, buf->dsize);
+  buf->dptr = buf->data + offset;
 }
index 0a12eb558d5033318630439de45996276f721898..b6a7900da51fa815d9bb43905340e730e7591d4d 100644 (file)
@@ -347,8 +347,7 @@ int mutt_file_safe_rename(const char *src, const char *target)
   {
     link_errno = errno;
 
-    /*
-     * It is historically documented that link can return -1 if NFS
+    /* It is historically documented that link can return -1 if NFS
      * dies after creating the link.  In that case, we are supposed
      * to use stat to check if the link was created.
      *
@@ -361,7 +360,7 @@ int mutt_file_safe_rename(const char *src, const char *target)
     if ((lstat(src, &ssb) == 0) && (lstat(target, &tsb) == 0) &&
         (compare_stat(&ssb, &tsb) == 0))
     {
-      mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeded\n",
+      mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeeded\n",
                  src, target, strerror(errno), errno);
       goto success;
     }
@@ -404,12 +403,11 @@ int mutt_file_safe_rename(const char *src, const char *target)
     return -1;
   }
 
-  /*
-   * Remove the compare_stat() check, because it causes problems with maildir on
-   * filesystems that don't properly support hard links, such as
-   * sshfs.  The filesystem creates the link, but the resulting file
-   * is given a different inode number by the sshfs layer.  This
-   * results in an infinite loop creating links.
+  /* Remove the compare_stat() check, because it causes problems with maildir
+   * on filesystems that don't properly support hard links, such as sshfs.  The
+   * filesystem creates the link, but the resulting file is given a different
+   * inode number by the sshfs layer.  This results in an infinite loop
+   * creating links.
    */
 #if 0
   /* Stat both links and check if they are equal. */
diff --git a/mx.c b/mx.c
index 27709877ca9d273cd1614e88ed81b7e6369ff6b5..b6e17c655c570f3f98b687ffd76968041024d6f4 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -403,7 +403,7 @@ static int sync_mailbox(struct Context *ctx, int *index_hint)
   if ((rc != 0) && !ctx->quiet)
   {
     /* L10N: Displayed if a mailbox sync fails */
-    mutt_error(_("Unable to write %s!"), ctx->path);
+    mutt_error(_("Unable to write %s"), ctx->path);
   }
 
   return rc;
@@ -1273,7 +1273,7 @@ int mx_check_empty(const char *path)
     {
       bool passive = ImapPassive;
       ImapPassive = false;
-      int rv = imap_status(path, 0);
+      int rv = imap_status(path, false);
       ImapPassive = passive;
       return (rv <= 0);
     }
@@ -1510,8 +1510,10 @@ int mx_path_parent(char *buf, size_t buflen)
   return 0;
 }
 
-/* mx_msg_padding_size: Returns the padding size between messages for the
- * mailbox type pointed to by ctx.
+/**
+ * mx_msg_padding_size - Bytes of padding between messages - Wrapper for MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval num Number of bytes of padding
  *
  * mmdf and mbox add separators, which leads a small discrepancy when computing
  * vsize for a limited view.
diff --git a/pager.c b/pager.c
index 5a85e5cbffa2c91d202c76c240181618ab6932a7..765ea3d31a9e7bfcae21a85bb37ab52d2ccb9772 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -823,36 +823,41 @@ static int check_attachment_marker(char *p)
   return (int) (*p - *q);
 }
 
-/* Checks if buf matches the QuoteRegex and doesn't match Smileys.
- * pmatch, if non-null, is populated with the regexec match against
- * QuoteRegex.  This is used by the pager for calling classify_quote.
+/**
+ * mutt_is_quote_line - Is a line of message text a quote?
+ * @param[in]  line   Line to test
+ * @param[out] pmatch Regex sub-matches
+ * @retval true Line is quoted
+ *
+ * Checks if line matches the QuoteRegex and doesn't match Smileys.
+ * This is used by the pager for calling classify_quote.
  */
-int mutt_is_quote_line(char *buf, regmatch_t *pmatch)
+int mutt_is_quote_line(char *line, regmatch_t *pmatch)
 {
-  int is_quote = 0;
+  bool is_quote = false;
   regmatch_t pmatch_internal[1], smatch[1];
   char c;
 
   if (!pmatch)
     pmatch = pmatch_internal;
 
-  if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0)
+  if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0)
   {
-    if (Smileys && Smileys->regex && regexec(Smileys->regex, buf, 1, smatch, 0) == 0)
+    if (Smileys && Smileys->regex && regexec(Smileys->regex, line, 1, smatch, 0) == 0)
     {
       if (smatch[0].rm_so > 0)
       {
-        c = buf[smatch[0].rm_so];
-        buf[smatch[0].rm_so] = 0;
+        c = line[smatch[0].rm_so];
+        line[smatch[0].rm_so] = 0;
 
-        if (regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0)
-          is_quote = 1;
+        if (regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0)
+          is_quote = true;
 
-        buf[smatch[0].rm_so] = c;
+        line[smatch[0].rm_so] = c;
       }
     }
     else
-      is_quote = 1;
+      is_quote = true;
   }
 
   return is_quote;
@@ -2899,12 +2904,12 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
         break;
 
       case OP_COMPOSE_TO_SENDER:
-        CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
+        CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra));
         CHECK_ATTACH;
-        if (IsMsgAttach (extra))
-          mutt_attach_mail_sender (extra->fp, extra->hdr, extra->actx, extra->bdy);
+        if (IsMsgAttach(extra))
+          mutt_attach_mail_sender(extra->fp, extra->hdr, extra->actx, extra->bdy);
         else
-          ci_send_message (SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr);
+          ci_send_message(SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr);
         pager_menu->redraw = REDRAW_FULL;
         break;
 
index 2d0b094fcd1c001180771ac99d02da2adf6c68f9..806d3e9295772f3694e9f739412fd886fd5402c5 100644 (file)
@@ -1570,8 +1570,8 @@ void mutt_view_attachments(struct Header *hdr)
 
       case OP_COMPOSE_TO_SENDER:
         CHECK_ATTACH;
-        mutt_attach_mail_sender (CURATTACH->fp, hdr, actx,
-                                 menu->tagprefix ? NULL : CURATTACH->content);
+        mutt_attach_mail_sender(CURATTACH->fp, hdr, actx,
+                                menu->tagprefix ? NULL : CURATTACH->content);
         menu->redraw = REDRAW_FULL;
         break;
 
index 568d4bfe20af6be6643f24f2d4bd2940f5189831..353ed9f3db4038a5f9191d735a57cfa7e2be2628 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -1036,6 +1036,13 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx,
   }
 }
 
+/**
+ * mutt_attach_mail_sender - Compose an email to the sender in the email attachment
+ * @param fp   File containing attachment (UNUSED)
+ * @param hdr  Header of email (UNUSED)
+ * @param actx Attachment Context
+ * @param cur  Current attachment
+ */
 void mutt_attach_mail_sender(FILE *fp, struct Header *hdr,
                              struct AttachCtx *actx, struct Body *cur)
 {
diff --git a/send.c b/send.c
index e69efb6ad70cfbfa08bba45dc4c0f6f53edba214..78f2f393396c6c05b233a15a891dd5567fe31dce 100644 (file)
--- a/send.c
+++ b/send.c
@@ -762,7 +762,7 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags)
   }
   else if (flags & SEND_TO_SENDER)
   {
-    mutt_addr_append(&out->to, in->from, 0);
+    mutt_addr_append(&out->to, in->from, false);
   }
   else
   {
@@ -969,7 +969,7 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx,
   if (!curenv)
     return -1;
 
-  if (flags & (SEND_REPLY|SEND_TO_SENDER))
+  if (flags & (SEND_REPLY | SEND_TO_SENDER))
   {
 #ifdef USE_NNTP
     if ((flags & SEND_NEWS))
@@ -1006,7 +1006,7 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx,
     if (flags & SEND_REPLY)
     {
       mutt_make_misc_reply_headers(env, curenv);
-      make_reference_headers (tag ? NULL : curenv, env, ctx);
+      make_reference_headers(tag ? NULL : curenv, env, ctx);
     }
   }
   else if (flags & SEND_FORWARD)