* @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;
*
* 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;
* @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
tmp = STAILQ_NEXT(np, entries);
if (!*do_cache)
{
- *do_cache = 1;
+ *do_cache = true;
}
free_color_line(np, parse_uncolor);
np = tmp;
{
if (!*do_cache)
{
- *do_cache = 1;
+ *do_cache = true;
}
mutt_debug(1, "Freeing pattern \"%s\" from ColorList\n", buf->data);
if (tmp)
* * 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);
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
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);
}
/**
* @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
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;
}
}
if (r != 0)
{
regerror(r, &tmp->regex, err->data, err->dsize);
- free_color_line(tmp, 1);
+ free_color_line(tmp, true);
return -1;
}
}
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))
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;
#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:
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)
* @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)
{
* @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;
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++)
{
* @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)
{
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;
}
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)
{
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;
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;
}
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();
* @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;
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)
{
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"));
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"));
}
* @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;
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);
*/
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];
* @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)
{
* @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;
return 0;
}
/* multiple results, choose from query menu */
- query_menu(buf, buflen, results, 1);
+ query_menu(buf, buflen, results, true);
}
return 0;
}
{
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);
}
}
* @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];
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)
{
* @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;
}
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;
* @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;
/* 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 */