From afad849b4ae52ef5c42deacd523e00e69049683b Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 23 Jun 2017 09:14:40 +0300 Subject: [PATCH] lib-mail: message_header_hash_more() - refactor to use switch() --- src/lib-mail/message-header-hash.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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;