shrink some data at the source to avoid subsequent narrowing

This commit is contained in:
Oswald Buddenhagen 2019-07-28 21:24:17 +02:00
parent def22db096
commit 4d7e169e57
5 changed files with 10 additions and 9 deletions

View File

@ -218,7 +218,8 @@ typedef struct notifier {
#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
int index; int index;
#else #else
int fd, events; int fd;
short events;
#endif #endif
} notifier_t; } notifier_t;
@ -231,7 +232,7 @@ typedef struct notifier {
#endif #endif
void init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux ); 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 ); void wipe_notifier( notifier_t *sn );
typedef struct { typedef struct {

View File

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

View File

@ -40,7 +40,7 @@ typedef struct {
char *get_arg( conffile_t *cfile, int required, int *comment ); 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_int( conffile_t *cfile );
int parse_size( conffile_t *cfile ); int parse_size( conffile_t *cfile );
int getcline( conffile_t *cfile ); int getcline( conffile_t *cfile );

View File

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

View File

@ -695,7 +695,7 @@ init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void *aux )
} }
void 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 #ifdef HAVE_SYS_POLL_H
int idx = sn->index; int idx = sn->index;