]> granicus.if.org Git - neomutt/commitdiff
rename formatting functions
authorRichard Russon <rich@flatcap.org>
Sun, 26 Nov 2017 01:30:53 +0000 (01:30 +0000)
committerRichard Russon <rich@flatcap.org>
Sun, 26 Nov 2017 22:48:26 +0000 (22:48 +0000)
browser.c
compose.c
compress.c
format_flags.h
hdrline.c
ncrypt/crypt_gpgme.c
ncrypt/pgpkey.c
protos.h
recvattach.c
remailer.c
sidebar.c

index fc90239b6052174f4ea012f1271a458b0edc64bd..82c9999d01cc7afd4afa194360e10f9852077c8c 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -496,10 +496,11 @@ static const char *folder_format_str(char *dest, size_t destlen, size_t col, int
 }
 
 #ifdef USE_NNTP
-static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col, int cols,
-                                        char op, const char *src, const char *fmt,
-                                        const char *ifstring, const char *elsestring,
-                                        unsigned long data, enum FormatFlag flags)
+static const char *group_index_format_str(char *dest, size_t destlen, size_t col,
+                                          int cols, char op, const char *src,
+                                          const char *fmt, const char *ifstring,
+                                          const char *elsestring,
+                                          unsigned long data, enum FormatFlag flags)
 {
   char fn[SHORT_STRING], tmp[SHORT_STRING];
   struct Folder *folder = (struct Folder *) data;
@@ -538,10 +539,10 @@ static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col,
       {
         if (folder->ff->nd->unread != 0)
           mutt_expando_format(dest, destlen, col, cols, ifstring,
-                              newsgroup_format_str, data, flags);
+                              group_index_format_str, data, flags);
         else
           mutt_expando_format(dest, destlen, col, cols, elsestring,
-                              newsgroup_format_str, data, flags);
+                              group_index_format_str, data, flags);
       }
       else if (Context && Context->data == folder->ff->nd)
       {
@@ -907,7 +908,7 @@ static void folder_entry(char *s, size_t slen, struct Menu *menu, int num)
 #ifdef USE_NNTP
   if (option(OPT_NEWS))
     mutt_expando_format(s, slen, 0, MuttIndexWindow->cols,
-                        NONULL(GroupIndexFormat), newsgroup_format_str,
+                        NONULL(GroupIndexFormat), group_index_format_str,
                         (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
   else
 #endif
index 0d66014d002e6dcda5f0a24e9dbc6dd3af62cfa4..eaa3681f8c98027750463745e6bbb8c1d58fddfe 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -229,7 +229,7 @@ static void snd_entry(char *b, size_t blen, struct Menu *menu, int num)
   struct AttachCtx *actx = (struct AttachCtx *) menu->data;
 
   mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat),
-                      mutt_attach_fmt, (unsigned long) (actx->idx[actx->v2r[num]]),
+                      attach_format_str, (unsigned long) (actx->idx[actx->v2r[num]]),
                       MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR);
 }
 
index 2e7f308ba913bf4f2333a4222edcf5353d12abf1..c4684f826ba252ee110d341e86485133034b7fd8 100644 (file)
@@ -329,7 +329,7 @@ static char *escape_path(char *src)
 }
 
 /**
- * cb_format_str - Expand the filenames in the command string
+ * compress_format_str - Expand the filenames in the command string
  * @param dest        Buffer in which to save string
  * @param destlen     Buffer length
  * @param col         Starting column, UNUSED
@@ -343,13 +343,13 @@ static char *escape_path(char *src)
  * @param flags       Format flags, UNUSED
  * @retval src (unchanged)
  *
- * cb_format_str is a callback function for mutt_expando_format.  It understands
+ * compress_format_str is a callback function for mutt_expando_format.  It understands
  * two operators. '%f' : 'from' filename, '%t' : 'to' filename.
  */
-static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols,
-                                 char op, const char *src, const char *fmt,
-                                 const char *ifstring, const char *elsestring,
-                                 unsigned long data, enum FormatFlag flags)
+static const char *compress_format_str(char *dest, size_t destlen, size_t col, int cols,
+                                       char op, const char *src, const char *fmt,
+                                       const char *ifstring, const char *elsestring,
+                                       unsigned long data, enum FormatFlag flags)
 {
   if (!dest || (data == 0))
     return src;
@@ -379,7 +379,7 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col
  *
  * This function takes a hook command and expands the filename placeholders
  * within it.  The function calls mutt_expando_format() to do the replacement
- * which calls our callback function cb_format_str(). e.g.
+ * which calls our callback function compress_format_str(). e.g.
  *
  * Template command:
  *      gzip -cd '%f' > '%t'
@@ -392,7 +392,8 @@ static void expand_command_str(const struct Context *ctx, const char *cmd, char
   if (!ctx || !cmd || !buf)
     return;
 
-  mutt_expando_format(buf, buflen, 0, buflen, cmd, cb_format_str, (unsigned long) ctx, 0);
+  mutt_expando_format(buf, buflen, 0, buflen, cmd, compress_format_str,
+                      (unsigned long) ctx, 0);
 }
 
 /**
index 501ec84aedf3e6c0c04c531768068bc296586736..3ddb41b9fca7e9078308ed93a77a7359d520cd34 100644 (file)
@@ -34,7 +34,7 @@ enum FormatFlag
   MUTT_FORMAT_TREE        = (1 << 1), /**< draw the thread tree */
   MUTT_FORMAT_MAKEPRINT   = (1 << 2), /**< make sure that all chars are printable */
   MUTT_FORMAT_OPTIONAL    = (1 << 3), /**< allow optional field processing */
-  MUTT_FORMAT_STAT_FILE   = (1 << 4), /**< used by mutt_attach_fmt */
+  MUTT_FORMAT_STAT_FILE   = (1 << 4), /**< used by attach_format_str */
   MUTT_FORMAT_ARROWCURSOR = (1 << 5), /**< reserve space for arrow_cursor */
   MUTT_FORMAT_INDEX       = (1 << 6), /**< this is a main index entry */
   MUTT_FORMAT_NOFILTER    = (1 << 7)  /**< do not allow filtering on this pass */
index c0d3af34b12b70d1e1a153d71c8fad6844b40022..dd08f80f72fb5387dfc8da17168397a33bacb988 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -410,7 +410,7 @@ static bool thread_is_old(struct Context *ctx, struct Header *hdr)
 }
 
 /**
- * hdr_format_str - Format a string, like printf()
+ * index_format_str - Format a string, like printf()
  *
  * | Expando | Description
  * |:--------|:-----------------------------------------------------------------
@@ -458,10 +458,10 @@ static bool thread_is_old(struct Context *ctx, struct Header *hdr)
  * | \%zt    | message tag flags
  * | \%Z     | combined message flags
  */
-static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int cols,
-                                  char op, const char *src, const char *prefix,
-                                  const char *ifstring, const char *elsestring,
-                                  unsigned long data, enum FormatFlag flags)
+static const char *index_format_str(char *dest, size_t destlen, size_t col, int cols,
+                                    char op, const char *src, const char *prefix,
+                                    const char *ifstring, const char *elsestring,
+                                    unsigned long data, enum FormatFlag flags)
 {
   struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data;
   struct Header *hdr = NULL, *htmp = NULL;
@@ -1323,10 +1323,10 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co
   }
 
   if (optional)
-    mutt_expando_format(dest, destlen, col, cols, ifstring, hdr_format_str,
+    mutt_expando_format(dest, destlen, col, cols, ifstring, index_format_str,
                         (unsigned long) hfi, flags);
   else if (flags & MUTT_FORMAT_OPTIONAL)
-    mutt_expando_format(dest, destlen, col, cols, elsestring, hdr_format_str,
+    mutt_expando_format(dest, destlen, col, cols, elsestring, index_format_str,
                         (unsigned long) hfi, flags);
 
   return src;
@@ -1342,11 +1342,11 @@ void mutt_make_string_flags(char *dest, size_t destlen, const char *s,
   hfi.pager_progress = 0;
 
   mutt_expando_format(dest, destlen, 0, MuttIndexWindow->cols, s,
-                      hdr_format_str, (unsigned long) &hfi, flags);
+                      index_format_str, (unsigned long) &hfi, flags);
 }
 
 void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s,
                            struct HdrFormatInfo *hfi, enum FormatFlag flags)
 {
-  mutt_expando_format(dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long) hfi, flags);
+  mutt_expando_format(dst, dstlen, 0, cols, s, index_format_str, (unsigned long) hfi, flags);
 }
index 6fa9f3e5290280d6cd83da640774b6ec8062ee7c..aebfcbfe31570d5d9032a8caf16a305eb2bbdfd2 100644 (file)
@@ -2891,7 +2891,7 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s)
 }
 
 /**
- * crypt_entry_fmt - Format an entry on the CRYPT key selection menu
+ * crypt_format_str - Format an entry on the CRYPT key selection menu
  *
  * * \%u user id
  * * \%n number
@@ -2911,10 +2911,10 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s)
  * * \%F flags of the principal key
  * * \%C capabilities of the principal key
  */
-static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
-                                   char op, const char *src, const char *prefix,
-                                   const char *ifstring, const char *elsestring,
-                                   unsigned long data, enum FormatFlag flags)
+static const char *crypt_format_str(char *dest, size_t destlen, size_t col, int cols,
+                                    char op, const char *src, const char *prefix,
+                                    const char *ifstring, const char *elsestring,
+                                    unsigned long data, enum FormatFlag flags)
 {
   char fmt[16];
   struct CryptEntry *entry = NULL;
@@ -3103,9 +3103,9 @@ static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int c
   }
 
   if (optional)
-    mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, ifstring, attach_format_str, data, 0);
   else if (flags & MUTT_FORMAT_OPTIONAL)
-    mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, elsestring, attach_format_str, data, 0);
   return src;
 }
 
@@ -3121,7 +3121,7 @@ static void crypt_entry(char *s, size_t l, struct Menu *menu, int num)
   entry.num = num + 1;
 
   mutt_expando_format(s, l, 0, MuttIndexWindow->cols, NONULL(PgpEntryFormat),
-                      crypt_entry_fmt, (unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR);
+                      crypt_format_str, (unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR);
 }
 
 /**
index a841ae71c92773db122405bf6791f4891c04893c..0c9b46de50ef6b0361eda5b4832586f6ff4e81e0 100644 (file)
@@ -289,9 +289,9 @@ static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int col
   }
 
   if (optional)
-    mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, ifstring, attach_format_str, data, 0);
   else if (flags & MUTT_FORMAT_OPTIONAL)
-    mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, elsestring, attach_format_str, data, 0);
   return src;
 }
 
index 60c2589602a31c592a70f1466c0d36605b4e9aa9..8b7081d95a6a4a55f2474eaa2a23bed1dd9275a1 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -58,7 +58,7 @@ void mutt_make_string_flags(char *dest, size_t destlen, const char *s, struct Co
                        struct Header *hdr, enum FormatFlag flags);
 
 /**
- * struct HdrFormatInfo - Data passed to hdr_format_str()
+ * struct HdrFormatInfo - Data passed to index_format_str()
  */
 struct HdrFormatInfo
 {
@@ -120,7 +120,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, short user
 
 int is_from(const char *s, char *path, size_t pathlen, time_t *tp);
 
-const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols,
+const char *attach_format_str(char *dest, size_t destlen, size_t col, int cols,
                             char op, const char *src, const char *prefix,
                             const char *ifstring, const char *elsestring,
                             unsigned long data, enum FormatFlag flags);
index 9dd38319c822906fac793bee6bf81fed6b9db549..5ae6c4cd4aaa343c3e3d3919831ed4ecd54ea939 100644 (file)
@@ -140,7 +140,7 @@ void mutt_update_tree(struct AttachCtx *actx)
 }
 
 /**
- * mutt_attach_fmt - Format string for attachment menu
+ * attach_format_str - Format string for attachment menu
  *
  * | Expando | Description
  * |:--------|:--------------------------------------------------------
@@ -160,10 +160,10 @@ void mutt_update_tree(struct AttachCtx *actx)
  * | \%s     | size
  * | \%u     | unlink
  */
-const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols,
-                            char op, const char *src, const char *prefix,
-                            const char *ifstring, const char *elsestring,
-                            unsigned long data, enum FormatFlag flags)
+const char *attach_format_str(char *dest, size_t destlen, size_t col, int cols,
+                              char op, const char *src, const char *prefix,
+                              const char *ifstring, const char *elsestring,
+                              unsigned long data, enum FormatFlag flags)
 {
   char fmt[16];
   char tmp[SHORT_STRING];
@@ -372,9 +372,9 @@ const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols,
   }
 
   if (optional)
-    mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, ifstring, attach_format_str, data, 0);
   else if (flags & MUTT_FORMAT_OPTIONAL)
-    mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, elsestring, attach_format_str, data, 0);
   return src;
 }
 
@@ -383,7 +383,7 @@ static void attach_entry(char *b, size_t blen, struct Menu *menu, int num)
   struct AttachCtx *actx = (struct AttachCtx *) menu->data;
 
   mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat),
-                      mutt_attach_fmt, (unsigned long) (actx->idx[actx->v2r[num]]),
+                      attach_format_str, (unsigned long) (actx->idx[actx->v2r[num]]),
                       MUTT_FORMAT_ARROWCURSOR);
 }
 
index 2cb140b6905e4984f9f96af1188a559f549aa7d1..939bea513a200d18c417f02eda8da4c4ab295407 100644 (file)
@@ -350,17 +350,17 @@ static const char *mix_format_caps(struct Remailer *r)
 }
 
 /**
- * mix_entry_fmt - Format an entry for the remailer menu
+ * mix_format_str - Format an entry for the remailer menu
  *
  * * %n number
  * * %c capabilities
  * * %s short name
  * * %a address
  */
-static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int cols,
-                                 char op, const char *src, const char *prefix,
-                                 const char *ifstring, const char *elsestring,
-                                 unsigned long data, enum FormatFlag flags)
+static const char *mix_format_str(char *dest, size_t destlen, size_t col, int cols,
+                                  char op, const char *src, const char *prefix,
+                                  const char *ifstring, const char *elsestring,
+                                  unsigned long data, enum FormatFlag flags)
 {
   char fmt[16];
   struct Remailer *remailer = (struct Remailer *) data;
@@ -406,16 +406,16 @@ static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int col
   }
 
   if (optional)
-    mutt_expando_format(dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, ifstring, attach_format_str, data, 0);
   else if (flags & MUTT_FORMAT_OPTIONAL)
-    mutt_expando_format(dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
+    mutt_expando_format(dest, destlen, col, cols, elsestring, attach_format_str, data, 0);
   return src;
 }
 
 static void mix_entry(char *b, size_t blen, struct Menu *menu, int num)
 {
   struct Remailer **type2_list = (struct Remailer **) menu->data;
-  mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(MixEntryFormat), mix_entry_fmt,
+  mutt_expando_format(b, blen, 0, MuttIndexWindow->cols, NONULL(MixEntryFormat), mix_format_str,
                       (unsigned long) type2_list[num], MUTT_FORMAT_ARROWCURSOR);
 }
 
index 1b6938de9273fbc8733d4e9640d48216880bf4ec..f0cdcf4f1930deb187e203fe5e4aeba248c20582 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -88,7 +88,7 @@ enum SidebarSrc
 } sidebar_source = SB_SRC_INCOMING;
 
 /**
- * cb_format_str - Create the string to show in the sidebar
+ * sidebar_format_str - Create the string to show in the sidebar
  * @param[out] dest        Buffer in which to save string
  * @param[in]  destlen     Buffer length
  * @param[in]  col         Starting column, UNUSED
@@ -102,16 +102,16 @@ enum SidebarSrc
  * @param[in]  flags       Format flags, e.g. MUTT_FORMAT_OPTIONAL
  * @retval src (unchanged)
  *
- * cb_format_str is a callback function for mutt_expando_format.  It understands
+ * sidebar_format_str is a callback function for mutt_expando_format.  It understands
  * six operators. '%B' : Mailbox name, '%F' : Number of flagged messages,
  * '%N' : Number of new messages, '%S' : Size (total number of messages),
  * '%!' : Icon denoting number of flagged messages.
  * '%n' : N if folder has new mail, blank otherwise.
  */
-static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols,
-                                 char op, const char *src, const char *prefix,
-                                 const char *ifstring, const char *elsestring,
-                                 unsigned long data, enum FormatFlag flags)
+static const char *sidebar_format_str(char *dest, size_t destlen, size_t col, int cols,
+                                      char op, const char *src, const char *prefix,
+                                      const char *ifstring, const char *elsestring,
+                                      unsigned long data, enum FormatFlag flags)
 {
   struct SbEntry *sbe = (struct SbEntry *) data;
   unsigned int optional;
@@ -223,10 +223,10 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col
 
   if (optional)
     mutt_expando_format(dest, destlen, col, SidebarWidth, ifstring,
-                        cb_format_str, (unsigned long) sbe, flags);
+                        sidebar_format_str, (unsigned long) sbe, flags);
   else if (flags & MUTT_FORMAT_OPTIONAL)
     mutt_expando_format(dest, destlen, col, SidebarWidth, elsestring,
-                        cb_format_str, (unsigned long) sbe, flags);
+                        sidebar_format_str, (unsigned long) sbe, flags);
 
   /* We return the format string, unchanged */
   return src;
@@ -242,7 +242,7 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col
  *
  * Take all the relevant mailbox data and the desired screen width and then get
  * mutt_expando_format to do the actual work. mutt_expando_format will callback to
- * us using cb_format_str() for the sidebar specific formatting characters.
+ * us using sidebar_format_str() for the sidebar specific formatting characters.
  */
 static void make_sidebar_entry(char *buf, unsigned int buflen, int width,
                                char *box, struct SbEntry *sbe)
@@ -253,7 +253,7 @@ static void make_sidebar_entry(char *buf, unsigned int buflen, int width,
   mutt_str_strfcpy(sbe->box, box, sizeof(sbe->box));
 
   mutt_expando_format(buf, buflen, 0, width, NONULL(SidebarFormat),
-                      cb_format_str, (unsigned long) sbe, 0);
+                      sidebar_format_str, (unsigned long) sbe, 0);
 
   /* Force string to be exactly the right width */
   int w = mutt_strwidth(buf);