From 1e427f5cd5caa1bd13fe9c6f564946ea2331a225 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 24 Nov 2013 19:55:41 +0100 Subject: [PATCH] do not unnecessarily use bitfields they don't save much (if any) space in our usage, while they make the machine code more bloated and slow. --- src/drv_imap.c | 15 +++++++-------- src/isync.h | 16 ++++++---------- src/main.c | 2 +- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index 43a7da0..e61ee6c 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -43,16 +43,16 @@ typedef struct imap_server_conf { char *pass_cmd; int max_in_progress; #ifdef HAVE_LIBSSL - unsigned require_ssl:1; - unsigned require_cram:1; + char require_ssl; + char require_cram; #endif } imap_server_conf_t; typedef struct imap_store_conf { store_conf_t gen; imap_server_conf_t *server; - unsigned use_namespace:1; char *delimiter; + char use_namespace; } imap_store_conf_t; typedef struct imap_message { @@ -123,11 +123,10 @@ struct imap_cmd { char *data; int data_len; int uid; /* to identify fetch responses */ - unsigned - high_prio:1, /* if command is queued, put it at the front of the queue. */ - to_trash:1, /* we are storing to trash, not current. */ - create:1, /* create the mailbox if we get an error ... */ - trycreate:1; /* ... but only if this is true or the server says so. */ + char high_prio; /* if command is queued, put it at the front of the queue. */ + char to_trash; /* we are storing to trash, not current. */ + char create; /* create the mailbox if we get an error ... */ + char trycreate; /* ... but only if this is true or the server says so. */ } param; }; diff --git a/src/isync.h b/src/isync.h index 6953eee..4d6249f 100644 --- a/src/isync.h +++ b/src/isync.h @@ -59,15 +59,11 @@ typedef struct server_conf { int port; #ifdef HAVE_LIBSSL char *cert_file; - unsigned use_imaps:1; - unsigned use_sslv2:1; - unsigned use_sslv3:1; - unsigned use_tlsv1:1; - unsigned use_tlsv11:1; - unsigned use_tlsv12:1; + char use_imaps; + char use_sslv2, use_sslv3, use_tlsv1, use_tlsv11, use_tlsv12; /* these are actually variables and are leaked at the end */ - unsigned ssl_ctx_valid:1; + char ssl_ctx_valid; unsigned num_trusted; SSL_CTX *SSLContext; #endif @@ -151,7 +147,7 @@ typedef struct store_conf { const char *map_inbox; const char *trash; unsigned max_size; /* off_t is overkill */ - unsigned trash_remote_new:1, trash_only_new:1; + char trash_remote_new, trash_only_new; } store_conf_t; typedef struct string_list { @@ -171,7 +167,7 @@ typedef struct channel_conf { string_list_t *patterns; int ops[2]; unsigned max_messages; /* for slave only */ - unsigned use_internal_date:1; + char use_internal_date; } channel_conf_t; typedef struct group_conf { @@ -221,7 +217,7 @@ typedef struct store { struct store *next; store_conf_t *conf; /* foreign */ string_list_t *boxes; /* _list results - own */ - unsigned listed:1; /* was _list already run? */ + char listed; /* was _list already run? */ void (*bad_callback)( void *aux ); void *bad_callback_aux; diff --git a/src/main.c b/src/main.c index 39211cf..fa769e7 100644 --- a/src/main.c +++ b/src/main.c @@ -198,7 +198,7 @@ typedef struct { const char *names[2]; char **argv, *boxlist, *boxp; int oind, ret, multiple, all, list, ops[2], state[2]; - unsigned done:1, skip:1, cben:1; + char done, skip, cben; } main_vars_t; #define AUX &mvars->t[t]