From 4d7e169e5722babc0b78c71ed33f68030aaffd13 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 28 Jul 2019 21:24:17 +0200 Subject: [PATCH] shrink some data at the source to avoid subsequent narrowing --- src/common.h | 5 +++-- src/config.c | 2 +- src/config.h | 2 +- src/sync.c | 8 ++++---- src/util.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common.h b/src/common.h index 1c10459..cd95ab2 100644 --- a/src/common.h +++ b/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 { diff --git a/src/config.c b/src/config.c index a2c0dda..f22e259 100644 --- a/src/config.c +++ b/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" ) || diff --git a/src/config.h b/src/config.h index 2025347..779c3ee 100644 --- a/src/config.h +++ b/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 ); diff --git a/src/sync.c b/src/sync.c index 4508ac1..0d62bb8 100644 --- a/src/sync.c +++ b/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); diff --git a/src/util.c b/src/util.c index 738254d..fc8c8df 100644 --- a/src/util.c +++ b/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;