]> granicus.if.org Git - neomutt/commitdiff
boolify params
authorRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 12:27:43 +0000 (13:27 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 14:08:29 +0000 (15:08 +0100)
12 files changed:
color.c
commands.c
compose.c
curs_main.c
edit.c
mutt_thread.c
mutt_thread.h
pager.c
query.c
recvcmd.c
remailer.c
rfc3676.c

diff --git a/color.c b/color.c
index 8ca73e0be6fa3a4b0841c58bc7e8d00544fe7fb7..690fef5ce2fea5b232f2d4c345f4d7b55f328490 100644 (file)
--- a/color.c
+++ b/color.c
@@ -164,7 +164,7 @@ static struct ColorLine *new_color_line(void)
  * @param tmp         ColorLine to free
  * @param free_colors If true, free its colours too
  */
-static void free_color_line(struct ColorLine *tmp, int free_colors)
+static void free_color_line(struct ColorLine *tmp, bool free_colors)
 {
   if (!tmp)
     return;
@@ -439,7 +439,7 @@ void mutt_free_color(int fg, int bg)
  *
  * Parse a colour name, such as "red", "brightgreen", "color123".
  */
-static int parse_color_name(const char *s, int *col, int *attr, int is_fg, struct Buffer *err)
+static int parse_color_name(const char *s, int *col, int *attr, bool is_fg, struct Buffer *err)
 {
   char *eptr = NULL;
   int is_alert = 0, is_bright = 0;
@@ -510,7 +510,7 @@ static int parse_color_name(const char *s, int *col, int *attr, int is_fg, struc
  * @param[in]     parse_uncolor If true, 'uncolor', else 'unmono'
  */
 static void do_uncolor(struct Buffer *buf, struct Buffer *s,
-                       struct ColorLineHead *cl, int *do_cache, bool parse_uncolor)
+                       struct ColorLineHead *cl, bool *do_cache, bool parse_uncolor)
 {
   struct ColorLine *np = NULL, *tmp = NULL;
   do
@@ -524,7 +524,7 @@ static void do_uncolor(struct Buffer *buf, struct Buffer *s,
         tmp = STAILQ_NEXT(np, entries);
         if (!*do_cache)
         {
-          *do_cache = 1;
+          *do_cache = true;
         }
         free_color_line(np, parse_uncolor);
         np = tmp;
@@ -541,7 +541,7 @@ static void do_uncolor(struct Buffer *buf, struct Buffer *s,
         {
           if (!*do_cache)
           {
-            *do_cache = 1;
+            *do_cache = true;
           }
           mutt_debug(1, "Freeing pattern \"%s\" from ColorList\n", buf->data);
           if (tmp)
@@ -572,9 +572,10 @@ static void do_uncolor(struct Buffer *buf, struct Buffer *s,
  * * unmono  index pattern [pattern...]
  */
 static int parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data,
-                         struct Buffer *err, short parse_uncolor)
+                         struct Buffer *err, bool parse_uncolor)
 {
-  int object = 0, do_cache = 0;
+  int object = 0;
+  bool do_cache = false;
 
   mutt_extract_token(buf, s, 0);
 
@@ -673,7 +674,7 @@ static int parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long dat
 int mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data,
                        struct Buffer *err)
 {
-  return parse_uncolor(buf, s, data, err, 1);
+  return parse_uncolor(buf, s, data, err, true);
 }
 
 #endif
@@ -690,7 +691,7 @@ int mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data,
 int mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, unsigned long data,
                       struct Buffer *err)
 {
-  return parse_uncolor(buf, s, data, err, 0);
+  return parse_uncolor(buf, s, data, err, false);
 }
 
 /**
@@ -707,8 +708,8 @@ int mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, unsigned long data,
  * @retval  0 Success
  * @retval -1 Error
  */
-static int add_pattern(struct ColorLineHead *top, const char *s, int sensitive, int fg,
-                       int bg, int attr, struct Buffer *err, int is_index, int match)
+static int add_pattern(struct ColorLineHead *top, const char *s, bool sensitive, int fg,
+                       int bg, int attr, struct Buffer *err, bool is_index, int match)
 {
   /* is_index used to store compiled pattern
    * only for `index' color object
@@ -759,7 +760,7 @@ static int add_pattern(struct ColorLineHead *top, const char *s, int sensitive,
       tmp->color_pattern = mutt_pattern_comp(buf, MUTT_FULL_MSG, err);
       if (!tmp->color_pattern)
       {
-        free_color_line(tmp, 1);
+        free_color_line(tmp, true);
         return -1;
       }
     }
@@ -775,7 +776,7 @@ static int add_pattern(struct ColorLineHead *top, const char *s, int sensitive,
       if (r != 0)
       {
         regerror(r, &tmp->regex, err->data, err->dsize);
-        free_color_line(tmp, 1);
+        free_color_line(tmp, true);
         return -1;
       }
     }
@@ -893,7 +894,7 @@ static int parse_color_pair(struct Buffer *buf, struct Buffer *s, int *fg,
 
   mutt_extract_token(buf, s, 0);
 
-  if (parse_color_name(buf->data, fg, attr, 1, err) != 0)
+  if (parse_color_name(buf->data, fg, attr, true, err) != 0)
     return -1;
 
   if (!MoreArgs(s))
@@ -904,7 +905,7 @@ static int parse_color_pair(struct Buffer *buf, struct Buffer *s, int *fg,
 
   mutt_extract_token(buf, s, 0);
 
-  if (parse_color_name(buf->data, bg, attr, 0, err) != 0)
+  if (parse_color_name(buf->data, bg, attr, false, err) != 0)
     return -1;
 
   return 0;
@@ -1053,11 +1054,11 @@ static int parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err,
 #endif
 
   if (object == MT_COLOR_HEADER)
-    r = add_pattern(&ColorHdrList, buf->data, 0, fg, bg, attr, err, 0, match);
+    r = add_pattern(&ColorHdrList, buf->data, false, fg, bg, attr, err, false, match);
   else if (object == MT_COLOR_BODY)
-    r = add_pattern(&ColorBodyList, buf->data, 1, fg, bg, attr, err, 0, match);
+    r = add_pattern(&ColorBodyList, buf->data, true, fg, bg, attr, err, false, match);
   else if (object == MT_COLOR_ATTACH_HEADERS)
-    r = add_pattern(&ColorAttachList, buf->data, 1, fg, bg, attr, err, 0, match);
+    r = add_pattern(&ColorAttachList, buf->data, true, fg, bg, attr, err, false, match);
   else if ((object == MT_COLOR_STATUS) && MoreArgs(s))
   {
     /* 'color status fg bg' can have up to 2 arguments:
@@ -1081,31 +1082,31 @@ static int parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err,
       return -1;
     }
 
-    r = add_pattern(&ColorStatusList, buf->data, 1, fg, bg, attr, err, 0, match);
+    r = add_pattern(&ColorStatusList, buf->data, true, fg, bg, attr, err, false, match);
   }
   else if (object == MT_COLOR_INDEX)
   {
-    r = add_pattern(&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1, match);
+    r = add_pattern(&ColorIndexList, buf->data, true, fg, bg, attr, err, true, match);
     mutt_menu_set_redraw_full(MENU_MAIN);
   }
   else if (object == MT_COLOR_INDEX_AUTHOR)
   {
-    r = add_pattern(&ColorIndexAuthorList, buf->data, 1, fg, bg, attr, err, 1, match);
+    r = add_pattern(&ColorIndexAuthorList, buf->data, true, fg, bg, attr, err, true, match);
     mutt_menu_set_redraw_full(MENU_MAIN);
   }
   else if (object == MT_COLOR_INDEX_FLAGS)
   {
-    r = add_pattern(&ColorIndexFlagsList, buf->data, 1, fg, bg, attr, err, 1, match);
+    r = add_pattern(&ColorIndexFlagsList, buf->data, true, fg, bg, attr, err, true, match);
     mutt_menu_set_redraw_full(MENU_MAIN);
   }
   else if (object == MT_COLOR_INDEX_SUBJECT)
   {
-    r = add_pattern(&ColorIndexSubjectList, buf->data, 1, fg, bg, attr, err, 1, match);
+    r = add_pattern(&ColorIndexSubjectList, buf->data, true, fg, bg, attr, err, true, match);
     mutt_menu_set_redraw_full(MENU_MAIN);
   }
   else if (object == MT_COLOR_INDEX_TAG)
   {
-    r = add_pattern(&ColorIndexTagList, buf->data, 1, fg, bg, attr, err, 1, match);
+    r = add_pattern(&ColorIndexTagList, buf->data, true, fg, bg, attr, err, true, match);
     mutt_menu_set_redraw_full(MENU_MAIN);
   }
   else if (object == MT_COLOR_QUOTED)
index 5f42ac7be81c8f95ed490345016d9096597600bb..9254b4424091a85e40aeb1736cee8ae042c656ba 100644 (file)
@@ -385,7 +385,7 @@ void ci_bounce_message(struct Header *h)
  * @param[out] cmflags Copy message flags, e.g. MUTT_CM_DECODE
  * @param[out] chflags Copy header flags, e.g. CH_DECODE
  */
-static void pipe_set_flags(int decode, int print, int *cmflags, int *chflags)
+static void pipe_set_flags(bool decode, bool print, int *cmflags, int *chflags)
 {
   if (decode)
   {
index c803644f3a31d369fd3d28a20fd107313d49d60d..5ca933ae3de79f8bcbfcf598a048fd934e5b826a 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -198,7 +198,7 @@ static struct Mapping ComposeNewsHelp[] = {
  * @param header   Header string
  * @param calc_max If true, calculate the maximum width
  */
-static void calc_header_width_padding(int idx, const char *header, int calc_max)
+static void calc_header_width_padding(int idx, const char *header, bool calc_max)
 {
   int width;
 
@@ -226,12 +226,12 @@ static void init_header_padding(void)
   done = 1;
 
   for (int i = 0; i <= HDR_XCOMMENTTO; i++)
-    calc_header_width_padding(i, _(Prompts[i]), 1);
+    calc_header_width_padding(i, _(Prompts[i]), true);
 
   /* Don't include "Sign as: " in the MaxHeaderWidth calculation.  It
    * doesn't show up by default, and so can make the indentation of
    * the other fields look funny. */
-  calc_header_width_padding(HDR_CRYPTINFO, _(Prompts[HDR_CRYPTINFO]), 0);
+  calc_header_width_padding(HDR_CRYPTINFO, _(Prompts[HDR_CRYPTINFO]), false);
 
   for (int i = 0; i <= HDR_XCOMMENTTO; i++)
   {
@@ -619,7 +619,7 @@ static void mutt_gen_compose_attach_list(struct AttachCtx *actx, struct Body *m,
  * @param menu Current menu
  * @param init If true, initialise the attachment list
  */
-static void mutt_update_compose_menu(struct AttachCtx *actx, struct Menu *menu, int init)
+static void mutt_update_compose_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
 {
   if (init)
   {
@@ -655,7 +655,7 @@ static void update_idx(struct Menu *menu, struct AttachCtx *actx, struct AttachP
     actx->idx[actx->idxlen - 1]->content->next = new->content;
   new->content->aptr = new;
   mutt_actx_add_attach(actx, new);
-  mutt_update_compose_menu(actx, menu, 0);
+  mutt_update_compose_menu(actx, menu, false);
   menu->current = actx->vcount - 1;
 }
 
@@ -939,7 +939,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
   struct AttachCtx *actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1);
   actx->hdr = msg;
-  mutt_update_compose_menu(actx, menu, 1);
+  mutt_update_compose_menu(actx, menu, true);
 
   while (loop)
   {
@@ -1119,7 +1119,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         if (actx->idxlen && actx->idx[actx->idxlen - 1]->content->next)
         {
           mutt_actx_free_entries(actx);
-          mutt_update_compose_menu(actx, menu, 1);
+          mutt_update_compose_menu(actx, menu, true);
         }
 
         menu->redraw = REDRAW_FULL;
@@ -1532,7 +1532,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           CURATTACH->content->unlink = 0;
         if (delete_attachment(actx, menu->current) == -1)
           break;
-        mutt_update_compose_menu(actx, menu, 0);
+        mutt_update_compose_menu(actx, menu, false);
         if (menu->current == 0)
           msg->content = actx->idx[0]->content;
 
index 1ded70331f3c563070a14707a4aed9ecc8865f23..c58d1365314a4ca0914fb0c28e7bccc9e6a1487d 100644 (file)
@@ -356,7 +356,7 @@ static void resort_index(struct Menu *menu)
   }
 
   if ((Sort & SORT_MASK) == SORT_THREADS && menu->current < 0)
-    menu->current = mutt_parent_message(Context, current, 0);
+    menu->current = mutt_parent_message(Context, current, false);
 
   if (menu->current < 0)
     menu->current = ci_first_message();
diff --git a/edit.c b/edit.c
index 9a82874984c60d3e562f10a979e6fd5505a12c0d..113bb82e04472178bafe538142bbfdcca6d2e1cf 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -126,7 +126,7 @@ static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen,
  * @param[in]  verbose If true, report the file and bytes read
  * @retval ptr Pointer to allocated buffer
  */
-static char **be_snarf_file(const char *path, char **buf, int *max, int *len, int verbose)
+static char **be_snarf_file(const char *path, char **buf, int *max, int *len, bool verbose)
 {
   char tmp[LONG_STRING];
   struct stat sb;
@@ -399,7 +399,7 @@ int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur
 
   addstr(_("(End message with a . on a line by itself)\n"));
 
-  buf = be_snarf_file(path, buf, &bufmax, &buflen, 0);
+  buf = be_snarf_file(path, buf, &bufmax, &buflen, false);
 
   tmp[0] = '\0';
   while (!done)
@@ -478,7 +478,7 @@ int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur
           {
             strncpy(tmp, p, sizeof(tmp));
             mutt_expand_path(tmp, sizeof(tmp));
-            buf = be_snarf_file(tmp, buf, &bufmax, &buflen, 1);
+            buf = be_snarf_file(tmp, buf, &bufmax, &buflen, true);
           }
           else
             addstr(_("missing filename.\n"));
@@ -525,7 +525,7 @@ int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur
             else
               mutt_edit_file(NONULL(Visual), path);
 
-            buf = be_snarf_file(path, buf, &bufmax, &buflen, 0);
+            buf = be_snarf_file(path, buf, &bufmax, &buflen, false);
 
             addstr(_("(continue)\n"));
           }
index fff6053d103490ee2d92d1cb82f96a7403726913..5ec6f6676f02ad07ccdba5195418a30b842689d7 100644 (file)
@@ -1098,7 +1098,7 @@ int mutt_aside_thread(struct Header *hdr, short dir, short subthreads)
  * @retval >=0 Virtual index number of parent/root message
  * @retval -1 Error
  */
-int mutt_parent_message(struct Context *ctx, struct Header *hdr, int find_root)
+int mutt_parent_message(struct Context *ctx, struct Header *hdr, bool find_root)
 {
   struct MuttThread *thread = NULL;
   struct Header *parent = NULL;
index fa6f602bae709ccb4f493bd3f603be675c40eaf7..a3e4751130bde9c74e34a79601d8c2f784c2739f 100644 (file)
@@ -69,7 +69,7 @@ void mutt_draw_tree(struct Context *ctx);
 void mutt_clear_threads(struct Context *ctx);
 struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, bool init);
 void mutt_sort_threads(struct Context *ctx, bool init);
-int mutt_parent_message(struct Context *ctx, struct Header *hdr, int find_root);
+int mutt_parent_message(struct Context *ctx, struct Header *hdr, bool find_root);
 void mutt_set_virtual(struct Context *ctx);
 struct Hash *mutt_make_id_hash(struct Context *ctx);
 
diff --git a/pager.c b/pager.c
index ba55a34968a731f77afd1dc467e11f0a6d52198b..70dd2f4e1759f8fd97c77916431c6fe25fbe76cb 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -837,7 +837,7 @@ static int check_attachment_marker(char *p)
  */
 static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
                           int last, struct QClass **quote_list, int *q_level,
-                          int *force_redraw, int q_classify)
+                          int *force_redraw, bool q_classify)
 {
   struct ColorLine *color_line = NULL;
   regmatch_t pmatch[1], smatch[1];
@@ -1825,7 +1825,7 @@ out:
  * @param hiding true if lines have been hidden
  * @retval num New current line number
  */
-static int up_n_lines(int nlines, struct Line *info, int cur, int hiding)
+static int up_n_lines(int nlines, struct Line *info, int cur, bool hiding)
 {
   while (cur > 0 && nlines > 0)
   {
diff --git a/query.c b/query.c
index 13d7b370f6134fe14762a79c481531ae3ae9f19c..90563a97fe5ea08d873e42bdc0db8f182d17b8ab 100644 (file)
--- a/query.c
+++ b/query.c
@@ -349,7 +349,7 @@ static int query_tag(struct Menu *menu, int n, int m)
  * @param results Query List
  * @param retbuf  If true, populate the results
  */
-static void query_menu(char *buf, size_t buflen, struct Query *results, int retbuf)
+static void query_menu(char *buf, size_t buflen, struct Query *results, bool retbuf)
 {
   struct Menu *menu = NULL;
   struct Header *msg = NULL;
@@ -613,7 +613,7 @@ int mutt_query_complete(char *buf, size_t buflen)
       return 0;
     }
     /* multiple results, choose from query menu */
-    query_menu(buf, buflen, results, 1);
+    query_menu(buf, buflen, results, true);
   }
   return 0;
 }
@@ -635,10 +635,10 @@ void mutt_query_menu(char *buf, size_t buflen)
   {
     char buffer[STRING] = "";
 
-    query_menu(buffer, sizeof(buffer), NULL, 0);
+    query_menu(buffer, sizeof(buffer), NULL, false);
   }
   else
   {
-    query_menu(buf, buflen, NULL, 1);
+    query_menu(buf, buflen, NULL, true);
   }
 }
index af79946a4afbf8137399a0d8317c335c4d83e3b2..14700a62ec0d0417ff27abd8c10d8f01a2c8ea61 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -386,7 +386,7 @@ static struct AttachPtr *find_parent(struct AttachCtx *actx, struct Body *cur, s
  * @param ofp    File to write to
  * @param prefix Prefix for each line (OPTIONAL)
  */
-static void include_header(int quote, FILE *ifp, struct Header *hdr, FILE *ofp, char *prefix)
+static void include_header(bool quote, FILE *ifp, struct Header *hdr, FILE *ofp, char *prefix)
 {
   int chflags = CH_DECODE;
   char prefix2[SHORT_STRING];
@@ -991,7 +991,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx,
       st.flags |= MUTT_WEED;
 
     if (Header)
-      include_header(1, parent_fp, parent_hdr, tmpfp, prefix);
+      include_header(true, parent_fp, parent_hdr, tmpfp, prefix);
 
     if (cur)
     {
index 420621d6aec47e4fa7fd4bfe7bf55df962bc3150..631c551ddf1c2fd2e635858d702f96cc345195dc 100644 (file)
@@ -310,7 +310,7 @@ static void mix_screen_coordinates(struct Remailer **type2_list, struct Coord **
  * @param selected   true, if this item is selected
  */
 static void mix_redraw_ce(struct Remailer **type2_list, struct Coord *coords,
-                          struct MixChain *chain, int i, short selected)
+                          struct MixChain *chain, int i, bool selected)
 {
   if (!coords || !chain)
     return;
@@ -625,8 +625,8 @@ void mix_make_chain(struct ListHead *chainhead)
     }
     else if (c_cur != c_old)
     {
-      mix_redraw_ce(type2_list, coords, chain, c_old, 0);
-      mix_redraw_ce(type2_list, coords, chain, c_cur, 1);
+      mix_redraw_ce(type2_list, coords, chain, c_old, false);
+      mix_redraw_ce(type2_list, coords, chain, c_cur, true);
     }
 
     c_old = c_cur;
index 924d594b4458cf51a2e4f7c676724c7e41137a84..32262293f2b0d8be274192e970e6f38269b8938c 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -217,7 +217,7 @@ static int quote_width(struct State *s, int ql)
  * @param term If true, terminate with a new line
  */
 static void print_flowed_line(char *line, struct State *s, int ql,
-                              struct FlowedState *fst, int term)
+                              struct FlowedState *fst, bool term)
 {
   size_t width, w, words = 0;
   char *p = NULL;
@@ -352,7 +352,7 @@ int rfc3676_handler(struct Body *a, struct State *s)
 
     /* a fixed line either has no trailing space or is the
      * signature separator */
-    const int fixed = buf_len == buf_off || buf[buf_len - 1] != ' ' || sigsep;
+    const bool fixed = (buf_len == buf_off) || (buf[buf_len - 1] != ' ') || sigsep;
 
     /* print fixed-and-standalone, fixed-and-empty and sigsep lines as
      * fixed lines */