]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message_header_hash_more() - refactor to use switch()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 23 Jun 2017 06:14:40 +0000 (09:14 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 26 Jun 2017 08:51:04 +0000 (11:51 +0300)
src/lib-mail/message-header-hash.c

index f5db232dcd41854e634af004e1d61411d62ab411..80dfea47460b6e8962550d6868db00d53811294f 100644 (file)
@@ -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;