Explorar o código

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.
Oswald Buddenhagen %!s(int64=11) %!d(string=hai) anos
pai
achega
1e427f5cd5
Modificáronse 3 ficheiros con 14 adicións e 19 borrados
  1. 7 8
      src/drv_imap.c
  2. 6 10
      src/isync.h
  3. 1 1
      src/main.c

+ 7 - 8
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;
 };
 

+ 6 - 10
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;

+ 1 - 1
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]