diff src/lib-mail/message-decoder.c @ 6940:414c9d631a81 HEAD

Replaced t_push/t_pop calls with T_FRAME*() macros.
author Timo Sirainen <tss@iki.fi>
date Wed, 05 Dec 2007 17:47:44 +0200
parents 0b8a78914db7
children 3af80c378959
line wrap: on
line diff
--- a/src/lib-mail/message-decoder.c	Wed Dec 05 17:47:19 2007 +0200
+++ b/src/lib-mail/message-decoder.c	Wed Dec 05 17:47:44 2007 +0200
@@ -81,7 +81,6 @@
 	struct rfc822_parser_context parser;
 	string_t *value;
 
-	t_push();
 	value = t_str_new(64);
 	rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
 
@@ -105,7 +104,6 @@
 			ctx->content_type = CONTENT_TYPE_QP;
 		break;
 	}
-	t_pop();
 }
 
 static void
@@ -121,12 +119,9 @@
 
 	rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
 	(void)rfc822_skip_lwsp(&parser);
-	t_push();
 	str = t_str_new(64);
-	if (rfc822_parse_content_type(&parser, str) <= 0) {
-		t_pop();
+	if (rfc822_parse_content_type(&parser, str) <= 0)
 		return;
-	}
 
 	while (rfc822_parse_content_param(&parser, &key, &value) > 0) {
 		if (strcasecmp(key, "charset") == 0) {
@@ -135,7 +130,6 @@
 			break;
 		}
 	}
-	t_pop();
 }
 
 static bool message_decode_header(struct message_decoder_context *ctx,
@@ -149,12 +143,14 @@
 		return FALSE;
 	}
 
-	if (hdr->name_len == 12 &&
-	    strcasecmp(hdr->name, "Content-Type") == 0)
-		parse_content_type(ctx, hdr);
-	if (hdr->name_len == 25 &&
-	    strcasecmp(hdr->name, "Content-Transfer-Encoding") == 0)
-		parse_content_transfer_encoding(ctx, hdr);
+	T_FRAME(
+		if (hdr->name_len == 12 &&
+		    strcasecmp(hdr->name, "Content-Type") == 0)
+			parse_content_type(ctx, hdr);
+		if (hdr->name_len == 25 &&
+		    strcasecmp(hdr->name, "Content-Transfer-Encoding") == 0)
+			parse_content_transfer_encoding(ctx, hdr);
+	);
 
 	buffer_set_used_size(ctx->buf, 0);
 	message_header_decode_utf8(hdr->full_value, hdr->full_value_len,