From: Timo Sirainen Date: Fri, 23 Jun 2017 06:14:40 +0000 (+0300) Subject: lib-mail: message_header_hash_more() - refactor to use switch() X-Git-Tag: 2.3.0.rc1~1383 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afad849b4ae52ef5c42deacd523e00e69049683b;p=thirdparty%2Fdovecot%2Fcore.git lib-mail: message_header_hash_more() - refactor to use switch() --- diff --git a/src/lib-mail/message-header-hash.c b/src/lib-mail/message-header-hash.c index f5db232dcd..80dfea4746 100644 --- a/src/lib-mail/message-header-hash.c +++ b/src/lib-mail/message-header-hash.c @@ -30,14 +30,20 @@ void message_header_hash_more(struct message_header_hash_context *ctx, 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;