Browse Source

factor out ADD_NL() inside copy_msg_convert()

wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
dbffebf560
  1. 15
      src/sync_msg_cvt.c

15
src/sync_msg_cvt.c

@ -131,6 +131,13 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars )
extra += add_subj ? strlen(dummy_subj) + app_cr + 1 : strlen(dummy_pfx); extra += add_subj ? strlen(dummy_subj) + app_cr + 1 : strlen(dummy_pfx);
} }
#define ADD_NL() \
do { \
if (app_cr) \
*out_buf++ = '\r'; \
*out_buf++ = '\n'; \
} while (0)
vars->data.len = in_len + extra; vars->data.len = in_len + extra;
if (vars->data.len > INT_MAX) { if (vars->data.len > INT_MAX) {
free( in_buf ); free( in_buf );
@ -150,9 +157,7 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars )
out_buf += 8; out_buf += 8;
memcpy( out_buf, vars->srec->tuid, TUIDL ); memcpy( out_buf, vars->srec->tuid, TUIDL );
out_buf += TUIDL; out_buf += TUIDL;
if (app_cr) ADD_NL();
*out_buf++ = '\r';
*out_buf++ = '\n';
idx = ebreak; idx = ebreak;
if (break2 != UINT_MAX && break2 >= sbreak) { if (break2 != UINT_MAX && break2 >= sbreak) {
@ -163,9 +168,7 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars )
} else { } else {
memcpy( out_buf, dummy_subj, strlen(dummy_subj) ); memcpy( out_buf, dummy_subj, strlen(dummy_subj) );
out_buf += strlen(dummy_subj); out_buf += strlen(dummy_subj);
if (app_cr) ADD_NL();
*out_buf++ = '\r';
*out_buf++ = '\n';
} }
} }
} }

Loading…
Cancel
Save