]> diplodocus.org Git - nmh/commitdiff
Replace boolean with bool everywhere.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 3 Sep 2017 22:29:36 +0000 (23:29 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 3 Sep 2017 22:29:36 +0000 (23:29 +0100)
boolean's comment said it existed to ensure storage was a char and not
an int so it could be packed in a struct, but the only struct using it
doesn't care about the space taken.

h/crawl_folders.h
h/mh.h
h/oauth.h
sbr/oauth.c
sbr/oauth_prof.c
uip/folder.c
uip/new.c

index 7633b2e..dac08f8 100644 (file)
@@ -5,7 +5,7 @@
 
 /* Callbacks return TRUE crawl_folders should crawl the children of `folder'.
  * Callbacks need not duplicate folder, as crawl_folders does not free it. */
 
 /* Callbacks return TRUE crawl_folders should crawl the children of `folder'.
  * Callbacks need not duplicate folder, as crawl_folders does not free it. */
-typedef boolean (crawl_callback_t)(char *folder, void *baton);
+typedef bool (crawl_callback_t)(char *folder, void *baton);
 
 /* Crawl the folder hierarchy rooted at the relative path `dir'.  For each
  * folder, pass `callback' the folder name (as a path relative to the current
 
 /* Crawl the folder hierarchy rooted at the relative path `dir'.  For each
  * folder, pass `callback' the folder name (as a path relative to the current
diff --git a/h/mh.h b/h/mh.h
index 7673d2a..8823d91 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -28,7 +28,6 @@
 #ifndef TRUE
 #define TRUE true
 #endif
 #ifndef TRUE
 #define TRUE true
 #endif
-typedef unsigned char  boolean;  /* not int so we can pack in a structure */
 
 /* If we're using gcc then tell it extra information so it can do more
  * compile-time checks. */
 
 /* If we're using gcc then tell it extra information so it can do more
  * compile-time checks. */
index 1ba5314..3d5826d 100644 (file)
--- a/h/oauth.h
+++ b/h/oauth.h
@@ -130,7 +130,7 @@ mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
  *
  * On error, return FALSE and set an error in ctx; ctx is always allocated.
  */
  *
  * On error, return FALSE and set an error in ctx; ctx is always allocated.
  */
-boolean
+bool
 mh_oauth_new(mh_oauth_ctx **ctx, const char *svc_name);
 
 /*
 mh_oauth_new(mh_oauth_ctx **ctx, const char *svc_name);
 
 /*
@@ -198,13 +198,13 @@ mh_oauth_authorize(const char *code, mh_oauth_ctx *ctx);
  *
  * On error, return FALSE and leave cred untouched.
  */
  *
  * On error, return FALSE and leave cred untouched.
  */
-boolean
+bool
 mh_oauth_refresh(mh_oauth_cred *cred);
 
 /*
  * Return whether access token is present and not expired at time T.
  */
 mh_oauth_refresh(mh_oauth_cred *cred);
 
 /*
  * Return whether access token is present and not expired at time T.
  */
-boolean
+bool
 mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred) PURE;
 
 /*
 mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred) PURE;
 
 /*
@@ -228,7 +228,7 @@ mh_oauth_cred_fn(const char *svc_name);
  *
  * On error, return FALSE.
  */
  *
  * On error, return FALSE.
  */
-boolean
+bool
 mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user);
 
 /*
 mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user);
 
 /*
@@ -257,6 +257,6 @@ mh_oauth_sasl_client_response(size_t *res_len,
  * Retrieve the various entries for the OAuth mechanism
  */
 
  * Retrieve the various entries for the OAuth mechanism
  */
 
-boolean
+bool
 mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
                          char *errbuf, size_t errbuflen);
 mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
                          char *errbuf, size_t errbuflen);
index 3a8d291..a792729 100755 (executable)
@@ -110,7 +110,7 @@ struct curl_ctx {
 
     /* Whether the response was too big; if so, the rest of the output fields
      * are undefined. */
 
     /* Whether the response was too big; if so, the rest of the output fields
      * are undefined. */
-    boolean too_big;
+    bool too_big;
 
     /* HTTP response code */
     long res_code;
 
     /* HTTP response code */
     long res_code;
@@ -125,9 +125,9 @@ struct curl_ctx {
     char res_body[RESPONSE_BODY_MAX];
 };
 
     char res_body[RESPONSE_BODY_MAX];
 };
 
-static boolean get_json_strings(const char *, size_t, FILE *, ...) ENDNULL;
-static boolean make_query_url(char *, size_t, CURL *, const char *, ...) ENDNULL;
-static boolean post(struct curl_ctx *, const char *, const char *);
+static bool get_json_strings(const char *, size_t, FILE *, ...) ENDNULL;
+static bool make_query_url(char *, size_t, CURL *, const char *, ...) ENDNULL;
+static bool post(struct curl_ctx *, const char *, const char *);
 
 int
 mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
 
 int
 mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
@@ -195,7 +195,7 @@ mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
     return OK;
 }
 
     return OK;
 }
 
-static boolean
+static bool
 is_json(const char *content_type)
 {
     return content_type != NULL
 is_json(const char *content_type)
 {
     return content_type != NULL
@@ -248,7 +248,7 @@ make_user_agent(void)
     return concat(user_agent, " libcurl/", curl, NULL);
 }
 
     return concat(user_agent, " libcurl/", curl, NULL);
 }
 
-boolean
+bool
 mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
 {
     mh_oauth_ctx *ctx;
 mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
 {
     mh_oauth_ctx *ctx;
@@ -393,11 +393,11 @@ mh_oauth_get_authorize_url(mh_oauth_ctx *ctx)
     return ctx->buf;
 }
 
     return ctx->buf;
 }
 
-static boolean
+static bool
 cred_from_response(mh_oauth_cred *cred, const char *content_type,
                    const char *input, size_t input_len)
 {
 cred_from_response(mh_oauth_cred *cred, const char *content_type,
                    const char *input, size_t input_len)
 {
-    boolean result = FALSE;
+    bool result = FALSE;
     char *access_token, *expires_in, *refresh_token;
     const mh_oauth_ctx *ctx = cred->ctx;
 
     char *access_token, *expires_in, *refresh_token;
     const mh_oauth_ctx *ctx = cred->ctx;
 
@@ -456,7 +456,7 @@ cred_from_response(mh_oauth_cred *cred, const char *content_type,
     return result;
 }
 
     return result;
 }
 
-static boolean
+static bool
 do_access_request(mh_oauth_cred *cred, const char *req_body)
 {
     mh_oauth_ctx *ctx = cred->ctx;
 do_access_request(mh_oauth_cred *cred, const char *req_body)
 {
     mh_oauth_ctx *ctx = cred->ctx;
@@ -515,10 +515,10 @@ mh_oauth_authorize(const char *code, mh_oauth_ctx *ctx)
     return result;
 }
 
     return result;
 }
 
-boolean
+bool
 mh_oauth_refresh(mh_oauth_cred *cred)
 {
 mh_oauth_refresh(mh_oauth_cred *cred)
 {
-    boolean result;
+    bool result;
     mh_oauth_ctx *ctx = cred->ctx;
 
     if (cred->refresh_token == NULL) {
     mh_oauth_ctx *ctx = cred->ctx;
 
     if (cred->refresh_token == NULL) {
@@ -546,7 +546,7 @@ mh_oauth_refresh(mh_oauth_cred *cred)
     return result;
 }
 
     return result;
 }
 
-boolean
+bool
 mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred)
 {
     return cred->access_token != NULL && t + EXPIRY_FUDGE < cred->expires_at;
 mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred)
 {
     return cred->access_token != NULL && t + EXPIRY_FUDGE < cred->expires_at;
@@ -610,10 +610,10 @@ free_user_creds(struct user_creds *user_creds)
     free(user_creds);
 }
 
     free(user_creds);
 }
 
-static boolean
+static bool
 load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
 {
 load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
 {
-    boolean success = FALSE;
+    bool success = FALSE;
     char name[NAMESZ], value_buf[BUFSIZ];
     int state;
     m_getfld_state_t getfld_ctx;
     char name[NAMESZ], value_buf[BUFSIZ];
     int state;
     m_getfld_state_t getfld_ctx;
@@ -703,7 +703,7 @@ load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
     return success;
 }
 
     return success;
 }
 
-static boolean
+static bool
 save_user(FILE *fp, const char *user, const char *access, const char *refresh,
           long expires_at)
 {
 save_user(FILE *fp, const char *user, const char *access, const char *refresh,
           long expires_at)
 {
@@ -721,7 +721,7 @@ save_user(FILE *fp, const char *user, const char *access, const char *refresh,
     return TRUE;
 }
 
     return TRUE;
 }
 
-boolean
+bool
 mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user)
 {
     struct user_creds *user_creds;
 mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user)
 {
     struct user_creds *user_creds;
@@ -831,10 +831,10 @@ mh_oauth_sasl_client_response(size_t *res_len,
  * building the entire URL.  Some of URL may already have been written into the
  * result array in that case.
  */
  * building the entire URL.  Some of URL may already have been written into the
  * result array in that case.
  */
-static boolean
+static bool
 make_query_url(char *s, size_t size, CURL *curl, const char *base_url, ...)
 {
 make_query_url(char *s, size_t size, CURL *curl, const char *base_url, ...)
 {
-    boolean result = FALSE;
+    bool result = FALSE;
     size_t len;
     char *prefix;
     va_list ap;
     size_t len;
     char *prefix;
     va_list ap;
@@ -930,7 +930,7 @@ write_callback(const char *ptr, size_t size, size_t nmemb, void *userdata)
     return size;
 }
 
     return size;
 }
 
-static boolean
+static bool
 post(struct curl_ctx *ctx, const char *url, const char *req_body)
 {
     CURL *curl = ctx->curl;
 post(struct curl_ctx *ctx, const char *url, const char *req_body)
 {
     CURL *curl = ctx->curl;
@@ -997,7 +997,7 @@ post(struct curl_ctx *ctx, const char *url, const char *req_body)
  *
  * Even in that case, tokens has been allocated and must be freed.
  */
  *
  * Even in that case, tokens has been allocated and must be freed.
  */
-static boolean
+static bool
 parse_json(jsmntok_t **tokens, size_t *tokens_len,
            const char *input, size_t input_len, FILE *log)
 {
 parse_json(jsmntok_t **tokens, size_t *tokens_len,
            const char *input, size_t input_len, FILE *log)
 {
@@ -1043,7 +1043,7 @@ get_json_string(char **val, const char *input, const jsmntok_t *tokens,
     int skip_tokens = 0;
     /* whether the current token represents a field name */
     /* The next token will be the value. */
     int skip_tokens = 0;
     /* whether the current token represents a field name */
     /* The next token will be the value. */
-    boolean is_key = TRUE;
+    bool is_key = TRUE;
 
     int i;
     for (i = 1; i <= token_count; i++) {
 
     int i;
     for (i = 1; i <= token_count; i++) {
@@ -1106,10 +1106,10 @@ get_json_string(char **val, const char *input, const jsmntok_t *tokens,
  *
  * log may be used for debug-logging if not NULL.
  */
  *
  * log may be used for debug-logging if not NULL.
  */
-static boolean
+static bool
 get_json_strings(const char *input, size_t input_len, FILE *log, ...)
 {
 get_json_strings(const char *input, size_t input_len, FILE *log, ...)
 {
-    boolean result = FALSE;
+    bool result = FALSE;
     jsmntok_t *tokens;
     size_t tokens_len;
     va_list ap;
     jsmntok_t *tokens;
     size_t tokens_len;
     va_list ap;
index ab1338e..1da1eb3 100644 (file)
@@ -76,7 +76,7 @@ update_svc_field(char **field, const char *base_name, const char *svc)
 }
 
 /* Update all service_info fields that are overridden in profile. */
 }
 
 /* Update all service_info fields that are overridden in profile. */
-static boolean
+static bool
 update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
           size_t errbuflen)
 {
 update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
           size_t errbuflen)
 {
@@ -106,7 +106,7 @@ update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
     return TRUE;
 }
 
     return TRUE;
 }
 
-boolean
+bool
 mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
                          char *errbuf, size_t errbuflen)
 {
 mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
                          char *errbuf, size_t errbuflen)
 {
index 8db9e3e..f21ddca 100644 (file)
@@ -376,7 +376,7 @@ main (int argc, char **argv)
 }
 
 static int
 }
 
 static int
-get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
+get_folder_info_body (char *fold, char *msg, bool *crawl_children)
 {
     int        i, retval = 1;
     struct msgs *mp = NULL;
 {
     int        i, retval = 1;
     struct msgs *mp = NULL;
@@ -440,10 +440,10 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
     return retval;
 }
 
     return retval;
 }
 
-static boolean
+static bool
 get_folder_info_callback (char *fold, void *baton)
 {
 get_folder_info_callback (char *fold, void *baton)
 {
-    boolean crawl_children;
+    bool crawl_children;
     NMH_UNUSED (baton);
 
     get_folder_info_body (fold, NULL, &crawl_children);
     NMH_UNUSED (baton);
 
     get_folder_info_body (fold, NULL, &crawl_children);
@@ -454,7 +454,7 @@ get_folder_info_callback (char *fold, void *baton)
 static int
 get_folder_info (char *fold, char *msg)
 {
 static int
 get_folder_info (char *fold, char *msg)
 {
-    boolean crawl_children;
+    bool crawl_children;
     int retval;
 
     retval = get_folder_info_body (fold, msg, &crawl_children);
     int retval;
 
     retval = get_folder_info_body (fold, msg, &crawl_children);
index 080f065..137f2bc 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -76,7 +76,7 @@ count_messages(char *field)
 }
 
 /* Return TRUE if the sequence 'name' is in 'sequences'. */
 }
 
 /* Return TRUE if the sequence 'name' is in 'sequences'. */
-static boolean
+static bool
 seq_in_list(char *name, char *sequences[])
 {
     int i;
 seq_in_list(char *name, char *sequences[])
 {
     int i;
@@ -225,7 +225,7 @@ check_folder(char *folder, size_t len, struct list_state *b)
     }
 }
 
     }
 }
 
-static boolean
+static bool
 crawl_callback(char *folder, void *baton)
 {
     check_folder(folder, strlen(folder), baton);
 crawl_callback(char *folder, void *baton)
 {
     check_folder(folder, strlen(folder), baton);