From 9cbb051294001066eae14fcbb3cac5fd80aa3a3c Mon Sep 17 00:00:00 2001 From: Anton Rieger Date: Mon, 25 Sep 2017 03:10:01 +0200 Subject: [PATCH] bool: convert function parameters in buffy.h * buffy_check() * buffy_maildir_check() * buffy_mbox_check() * mh_buffy() --- buffy.c | 17 +++++++++-------- buffy.h | 2 +- mh.c | 16 ++++++++-------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/buffy.c b/buffy.c index 9cd85174a..1ad482686 100644 --- a/buffy.c +++ b/buffy.c @@ -186,7 +186,7 @@ static void buffy_free(struct Buffy **mailbox) * Checks the specified maildir subdir (cur or new) for new mail or mail counts. */ static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, - int check_new, int check_stats) + bool check_new, bool check_stats) { char path[LONG_STRING]; char msgpath[LONG_STRING]; @@ -206,7 +206,7 @@ static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, if (stat(path, &sb) == 0 && sb.st_mtime < mailbox->last_visited) { rc = 0; - check_new = 0; + check_new = false; } } @@ -249,7 +249,7 @@ static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, } mailbox->new = true; rc = 1; - check_new = 0; + check_new = false; if (!check_stats) break; } @@ -267,9 +267,10 @@ static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, * @param check_stats if true, also count total, new, and flagged messages * @retval 1 if the mailbox has new mail */ -static int buffy_maildir_check(struct Buffy *mailbox, int check_stats) +static int buffy_maildir_check(struct Buffy *mailbox, bool check_stats) { - int rc, check_new = 1; + int rc = 1; + bool check_new = true; if (check_stats) { @@ -295,7 +296,7 @@ static int buffy_maildir_check(struct Buffy *mailbox, int check_stats) * @param check_stats if true, also count total, new, and flagged messages * @retval 1 if the mailbox has new mail */ -static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, int check_stats) +static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, bool check_stats) { int rc = 0; int new_or_changed; @@ -341,7 +342,7 @@ static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, int check_st return rc; } -static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, int check_stats) +static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, bool check_stats) { struct stat sb; #ifdef USE_SIDEBAR @@ -415,7 +416,7 @@ static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, int check_sta break; case MUTT_MH: - if (mh_buffy(tmp, check_stats) > 0) + if (mh_buffy(tmp, check_stats)) BuffyCount++; break; #ifdef USE_NOTMUCH diff --git a/buffy.h b/buffy.h index c6e410643..587774d82 100644 --- a/buffy.h +++ b/buffy.h @@ -80,6 +80,6 @@ void mutt_buffy_cleanup(const char *buf, struct stat *st); /** mark mailbox just left as already notified */ void mutt_buffy_setnotified(const char *path); -int mh_buffy(struct Buffy *mailbox, int check_stats); +bool mh_buffy(struct Buffy *mailbox, bool check_stats); #endif /* _MUTT_BUFFY_H */ diff --git a/mh.c b/mh.c index ad1ad9629..d39734da7 100644 --- a/mh.c +++ b/mh.c @@ -296,11 +296,11 @@ static bool mh_valid_message(const char *s) * @param check_stats Also count total, new, and flagged messages * @retval true if the mailbox has new mail */ -int mh_buffy(struct Buffy *mailbox, int check_stats) +bool mh_buffy(struct Buffy *mailbox, bool check_stats) { struct MhSequences mhs; - int check_new = 1; - int rc = 0; + bool check_new = true; + bool rc = false; DIR *dirp = NULL; struct dirent *de = NULL; @@ -308,8 +308,8 @@ int mh_buffy(struct Buffy *mailbox, int check_stats) * since the last mailbox visit, there is no "new mail" */ if (option(OPT_MAIL_CHECK_RECENT) && mh_sequences_changed(mailbox) <= 0) { - rc = 0; - check_new = 0; + rc = false; + check_new = false; } if (!(check_new || check_stats)) @@ -317,7 +317,7 @@ int mh_buffy(struct Buffy *mailbox, int check_stats) memset(&mhs, 0, sizeof(mhs)); if (mh_read_sequences(&mhs, mailbox->path) < 0) - return 0; + return false; if (check_stats) { @@ -341,12 +341,12 @@ int mh_buffy(struct Buffy *mailbox, int check_stats) if (!option(OPT_MAIL_CHECK_RECENT) || mh_already_notified(mailbox, i) == 0) { mailbox->new = true; - rc = 1; + rc = true; } /* Because we are traversing from high to low, we can stop * checking for new mail after the first unseen message. * Whether it resulted in "new mail" or not. */ - check_new = 0; + check_new = false; if (!check_stats) break; } -- 2.40.0