[dovecot-cvs] dovecot/src/lib-mail istream-header-filter.h, 1.9, 1.10 message-content-parser.c, 1.15, 1.16 message-content-parser.h, 1.9, 1.10 message-header-decode.c, 1.7, 1.8 message-header-decode.h, 1.5, 1.6 message-header-parser.h, 1.3, 1.4 message-parser.h, 1.35, 1.36
tss at dovecot.org
tss at dovecot.org
Fri Dec 15 18:10:59 UTC 2006
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-cache-lookup.c, 1.36, 1.37 mail-cache-private.h, 1.35, 1.36 mail-hash.h, 1.12, 1.13 mail-index-private.h, 1.76, 1.77 mail-index.c, 1.247, 1.248
- Next message: [dovecot-cvs] dovecot/src/lib-sql sql-api.h,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv2752/lib-mail
Modified Files:
istream-header-filter.h message-content-parser.c
message-content-parser.h message-header-decode.c
message-header-decode.h message-header-parser.h
message-parser.h
Log Message:
Type safe callbacks weren't as easy as I thought. Only callback(void
*context) can be handled generically. Others can be handled specially, but
only if all the parameters are pointers, otherwise eg. int parameter can be
replaced with long without compiler giving any warnings.
Index: istream-header-filter.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/istream-header-filter.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- istream-header-filter.h 15 Dec 2006 16:55:41 -0000 1.9
+++ istream-header-filter.h 15 Dec 2006 18:10:57 -0000 1.10
@@ -27,10 +27,18 @@
const char *const *headers,
unsigned int headers_count,
header_filter_callback *callback, void *context);
-#define i_stream_create_header_filter(input, flags, headers, headers_count, \
- callback, context) \
- CONTEXT_CALLBACK3(i_stream_create_header_filter, \
- header_filter_callback, callback, context, \
- input, flags, headers, headers_count)
+#ifdef CONTEXT_TYPE_SAFETY
+# define i_stream_create_header_filter(input, flags, headers, headers_count, \
+ callback, context) \
+ ({(void)(1 ? 0 : callback((struct message_header_line *)0, \
+ (bool *)0, context)); \
+ i_stream_create_header_filter(input, flags, headers, headers_count, \
+ (header_filter_callback *)callback, context); })
+#else
+# define i_stream_create_header_filter(input, flags, headers, headers_count, \
+ callback, context) \
+ i_stream_create_header_filter(input, flags, headers, headers_count, \
+ (header_filter_callback *)callback, context)
+#endif
#endif
Index: message-content-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-content-parser.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- message-content-parser.c 15 Dec 2006 16:55:41 -0000 1.15
+++ message-content-parser.c 15 Dec 2006 18:10:57 -0000 1.16
@@ -8,7 +8,6 @@
parse_content_callback_t *null_parse_content_callback = NULL;
parse_content_param_callback_t *null_parse_content_param_callback = NULL;
-#undef message_content_parse_header
void message_content_parse_header(const unsigned char *data, size_t size,
parse_content_callback_t *callback,
parse_content_param_callback_t *param_cb,
Index: message-content-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-content-parser.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- message-content-parser.h 15 Dec 2006 16:55:41 -0000 1.9
+++ message-content-parser.h 15 Dec 2006 18:10:57 -0000 1.10
@@ -17,13 +17,5 @@
parse_content_callback_t *callback,
parse_content_param_callback_t *param_cb,
void *context);
-#ifdef CONTEXT_TYPE_SAFETY
-# define message_content_parse_header(data, size, callback, param_cb, context)\
- ({(void)(1 ? 0 : callback(0, 0, context)); \
- (void)(1 ? 0 : param_cb(0, 0, 0, 0, 0, context)); \
- message_content_parse_header(data, size, \
- (parse_content_callback_t *)callback, \
- (parse_content_param_callback_t *)param_cb, context); })
-#endif
#endif
Index: message-header-decode.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-decode.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- message-header-decode.c 15 Dec 2006 16:55:41 -0000 1.7
+++ message-header-decode.c 15 Dec 2006 18:10:57 -0000 1.8
@@ -84,7 +84,6 @@
return ret;
}
-#undef message_header_decode
void message_header_decode(const unsigned char *data, size_t size,
message_header_decode_callback_t *callback,
void *context)
Index: message-header-decode.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-decode.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- message-header-decode.h 15 Dec 2006 16:55:41 -0000 1.5
+++ message-header-decode.h 15 Dec 2006 18:10:57 -0000 1.6
@@ -12,9 +12,5 @@
void message_header_decode(const unsigned char *data, size_t size,
message_header_decode_callback_t *callback,
void *context);
-#define message_header_decode(data, size, callback, context) \
- CONTEXT_CALLBACK4(message_header_decode, \
- message_header_decode_callback_t, \
- callback, context, data, size)
#endif
Index: message-header-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-parser.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- message-header-parser.h 15 Dec 2006 16:55:42 -0000 1.3
+++ message-header-parser.h 15 Dec 2006 18:10:57 -0000 1.4
@@ -55,8 +55,15 @@
/* Read and parse the header from the given stream. */
void message_parse_header(struct istream *input, struct message_size *hdr_size,
message_header_callback_t *callback, void *context);
-#define message_parse_header(input, hdr_size, callback, context) \
- CONTEXT_CALLBACK2(message_parse_header, message_header_callback_t, \
- callback, context, input, hdr_size)
+#ifdef CONTEXT_TYPE_SAFETY
+# define message_parse_header(input, hdr_size, callback, context) \
+ ({(void)(1 ? 0 : callback((struct message_header_line *)0, context)); \
+ message_parse_header(input, hdr_size, \
+ (message_header_callback_t *)callback, context); })
+#else
+# define message_parse_header(input, hdr_size, callback, context) \
+ message_parse_header(input, hdr_size, \
+ (message_header_callback_t *)callback, context)
+#endif
#endif
Index: message-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- message-parser.h 15 Dec 2006 16:55:42 -0000 1.35
+++ message-parser.h 15 Dec 2006 18:10:57 -0000 1.36
@@ -74,29 +74,51 @@
struct message_size *hdr_size,
message_part_header_callback_t *callback,
void *context);
-#define message_parser_parse_header(ctx, hdr_size, callback, context) \
- CONTEXT_CALLBACK3(message_parser_parse_header, \
- message_part_header_callback_t, \
- callback, context, ctx, hdr_size)
+#ifdef CONTEXT_TYPE_SAFETY
+# define message_parser_parse_header(ctx, hdr_size, callback, context) \
+ ({(void)(1 ? 0 : callback((struct message_part *)0, \
+ (struct message_header_line *)0, context)); \
+ message_parser_parse_header(ctx, hdr_size, \
+ (message_part_header_callback_t *)callback, context); })
+#else
+# define message_parser_parse_header(ctx, hdr_size, callback, context) \
+ message_parser_parse_header(ctx, hdr_size, \
+ (message_part_header_callback_t *)callback, context)
+#endif
+
/* Read and parse body. If message is a MIME multipart or message/rfc822
message, hdr_callback is called for all headers. body_callback is called
for the body content. */
void message_parser_parse_body(struct message_parser_ctx *ctx,
message_part_header_callback_t *hdr_callback,
void *context);
-#define message_parser_parse_body(ctx, callback, context) \
- CONTEXT_CALLBACK3(message_parser_parse_body, \
- message_part_header_callback_t, \
- callback, context, ctx)
+#ifdef CONTEXT_TYPE_SAFETY
+# define message_parser_parse_body(ctx, callback, context) \
+ ({(void)(1 ? 0 : callback((struct message_part *)0, \
+ (struct message_header_line *)0, context)); \
+ message_parser_parse_body(ctx, \
+ (message_part_header_callback_t *)callback, context); })
+#else
+# define message_parser_parse_body(ctx, callback, context) \
+ message_parser_parse_body(ctx, \
+ (message_part_header_callback_t *)callback, context)
+#endif
/* callback is called for each field in message header. */
void message_parse_from_parts(struct message_part *part, struct istream *input,
message_part_header_callback_t *callback,
void *context);
-#define message_parse_from_parts(part, input, callback, context) \
- CONTEXT_CALLBACK3(message_parse_from_parts, \
- message_part_header_callback_t, \
- callback, context, part, input)
+#ifdef CONTEXT_TYPE_SAFETY
+# define message_parse_from_parts(part, input, callback, context) \
+ ({(void)(1 ? 0 : callback((struct message_part *)0, \
+ (struct message_header_line *)0, context)); \
+ message_parse_from_parts(part, input, \
+ (message_part_header_callback_t *)callback, context); })
+#else
+# define message_parse_from_parts(part, input, callback, context) \
+ message_parse_from_parts(part, input, \
+ (message_part_header_callback_t *)callback, context)
+#endif
/* Update the physical_size of all parts. If use_crlf is TRUE, they're set
to same as virtual_size. If use_crlf is FALSE, they're set to
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-cache-lookup.c, 1.36, 1.37 mail-cache-private.h, 1.35, 1.36 mail-hash.h, 1.12, 1.13 mail-index-private.h, 1.76, 1.77 mail-index.c, 1.247, 1.248
- Next message: [dovecot-cvs] dovecot/src/lib-sql sql-api.h,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list