Преглед изворни кода

shrink some data at the source to avoid subsequent narrowing

Oswald Buddenhagen пре 6 година
родитељ
комит
4d7e169e57
5 измењених фајлова са 10 додато и 9 уклоњено
  1. 3 2
      src/common.h
  2. 1 1
      src/config.c
  3. 1 1
      src/config.h
  4. 4 4
      src/sync.c
  5. 1 1
      src/util.c

+ 3 - 2
src/common.h

@@ -218,7 +218,8 @@ typedef struct notifier {
 #ifdef HAVE_SYS_POLL_H
 	int index;
 #else
-	int fd, events;
+	int fd;
+	short events;
 #endif
 } notifier_t;
 
@@ -231,7 +232,7 @@ typedef struct notifier {
 #endif
 
 void init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux );
-void conf_notifier( notifier_t *sn, int and_events, int or_events );
+void conf_notifier( notifier_t *sn, short and_events, short or_events );
 void wipe_notifier( notifier_t *sn );
 
 typedef struct {

+ 1 - 1
src/config.c

@@ -86,7 +86,7 @@ get_arg( conffile_t *cfile, int required, int *comment )
 	return ret;
 }
 
-int
+char
 parse_bool( conffile_t *cfile )
 {
 	if (!strcasecmp( cfile->val, "yes" ) ||

+ 1 - 1
src/config.h

@@ -40,7 +40,7 @@ typedef struct {
 
 char *get_arg( conffile_t *cfile, int required, int *comment );
 
-int parse_bool( conffile_t *cfile );
+char parse_bool( conffile_t *cfile );
 int parse_int( conffile_t *cfile );
 int parse_size( conffile_t *cfile );
 int getcline( conffile_t *cfile );

+ 4 - 4
src/sync.c

@@ -1397,7 +1397,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
 	message_t *tmsg;
 	flag_vars_t *fv;
 	int no[2], del[2], alive, todel;
-	int sflags, nflags, aflags, dflags;
+	uchar sflags, nflags, aflags, dflags;
 	uint hashsz, idx;
 
 	if (check_ret( sts, aux ))
@@ -1723,7 +1723,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
 			if (!(srec->status & S_PENDING)) {
 				if (!srec->msg[S])
 					continue;
-				uint nex = (srec->wstate / W_NEXPIRE) & 1;
+				uchar nex = (srec->wstate / W_NEXPIRE) & 1;
 				if (nex != ((srec->status / S_EXPIRED) & 1)) {
 					/* The record needs a state change ... */
 					if (nex != ((srec->status / S_EXPIRE) & 1)) {
@@ -1991,14 +1991,14 @@ flags_set_p2( sync_vars_t *svars, sync_rec_t *srec, int t )
 		jFprintf( svars, "%c %u %u 0\n", "><"[t], srec->uid[M], srec->uid[S] );
 		srec->uid[1-t] = 0;
 	} else {
-		uint nflags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
+		uchar nflags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
 		if (srec->flags != nflags) {
 			debug( "  pair(%u,%u): updating flags (%u -> %u; %sed)\n", srec->uid[M], srec->uid[S], srec->flags, nflags, str_hl[t] );
 			srec->flags = nflags;
 			jFprintf( svars, "* %u %u %u\n", srec->uid[M], srec->uid[S], nflags );
 		}
 		if (t == S) {
-			uint nex = (srec->wstate / W_NEXPIRE) & 1;
+			uchar nex = (srec->wstate / W_NEXPIRE) & 1;
 			if (nex != ((srec->status / S_EXPIRED) & 1)) {
 				debug( "  pair(%u,%u): expired %d (commit)\n", srec->uid[M], srec->uid[S], nex );
 				srec->status = (srec->status & ~S_EXPIRED) | (nex * S_EXPIRED);

+ 1 - 1
src/util.c

@@ -695,7 +695,7 @@ init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux )
 }
 
 void
-conf_notifier( notifier_t *sn, int and_events, int or_events )
+conf_notifier( notifier_t *sn, short and_events, short or_events )
 {
 #ifdef HAVE_SYS_POLL_H
 	int idx = sn->index;