Mercurial > dovecot > core-2.2
changeset 22260:a2f31392caec
lib-mail: message_header_hash_more() - refactor to use switch()
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 23 Jun 2017 09:14:40 +0300 |
parents | e6bb15e22709 |
children | 052275fa15ab |
files | src/lib-mail/message-header-hash.c |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/message-header-hash.c Thu Jun 22 11:43:05 2017 +0300 +++ b/src/lib-mail/message-header-hash.c Fri Jun 23 09:14:40 2017 +0300 @@ -30,14 +30,20 @@ remove any repeated '?', which hopefully will satisfy everybody. */ for (i = start = 0; i < size; i++) { - if ((data[i] < 0x20 || data[i] >= 0x7f || data[i] == '?') && - (data[i] != '\t' && data[i] != '\n')) { - /* remove repeated '?' */ - if (start < i || (i == 0 && !ctx->prev_was_questionmark)) { - method->loop(context, data + start, i-start); - method->loop(context, "?", 1); + switch (data[i]) { + case '\t': + case '\n': + break; + default: + if (data[i] < 0x20 || data[i] >= 0x7f || data[i] == '?') { + /* remove repeated '?' */ + if (start < i || (i == 0 && !ctx->prev_was_questionmark)) { + method->loop(context, data + start, i-start); + method->loop(context, "?", 1); + } + start = i+1; } - start = i+1; + break; } } ctx->prev_was_questionmark = start == i;