dovecot-2.2: Try to avoid (void) casts by adding more ATTR_NOWAR...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 27 04:26:17 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/096e4c4d62bb
changeset: 14689:096e4c4d62bb
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 27 04:24:53 2012 +0300
description:
Try to avoid (void) casts by adding more ATTR_NOWARN_UNUSED_RESULT.
diffstat:
src/lib-imap/imap-bodystructure.c | 10 +++++-----
src/lib-mail/message-date.c | 8 ++++----
src/lib-mail/message-decoder.c | 4 ++--
src/lib-mail/message-id.c | 4 ++--
src/lib-mail/message-parser.c | 2 +-
src/lib-mail/message-search.c | 2 +-
src/lib-mail/rfc822-parser.h | 3 ++-
src/lib-storage/index/index-attachment.c | 2 +-
src/lib/hash.c | 12 ++++++------
src/lib/md4.c | 9 +++++----
src/lib/md5.c | 9 +++++----
src/lib/ostream.c | 2 +-
src/plugins/fts/fts-build-mail.c | 2 +-
src/plugins/fts/fts-parser-script.c | 2 +-
14 files changed, 37 insertions(+), 34 deletions(-)
diffs (truncated from 335 to 300 lines):
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-imap/imap-bodystructure.c
--- a/src/lib-imap/imap-bodystructure.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-imap/imap-bodystructure.c Wed Jun 27 04:24:53 2012 +0300
@@ -44,7 +44,7 @@
bool charset_found = FALSE;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_content_type(&parser, str) < 0)
@@ -94,7 +94,7 @@
string_t *str;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_mime_token(&parser, str) >= 0) {
@@ -112,7 +112,7 @@
string_t *str;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_mime_token(&parser, str) < 0)
@@ -151,14 +151,14 @@
str = t_str_new(128);
str_append_c(str, '"');
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
while (rfc822_parse_atom(&parser, str) >= 0) {
str_append(str, "\" \"");
if (parser.data == parser.end || *parser.data != ',')
break;
parser.data++;
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
}
if (str_len(str) > 1) {
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/message-date.c
--- a/src/lib-mail/message-date.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/message-date.c Wed Jun 27 04:24:53 2012 +0300
@@ -123,7 +123,7 @@
/* [weekday_name "," ] dd month_name [yy]yy hh:mi[:ss] timezone */
memset(&tm, 0, sizeof(tm));
- (void)rfc822_skip_lwsp(&ctx->parser);
+ rfc822_skip_lwsp(&ctx->parser);
/* skip the optional weekday */
if (next_token(ctx, &value, &len) <= 0)
@@ -132,7 +132,7 @@
if (*ctx->parser.data != ',')
return FALSE;
ctx->parser.data++;
- (void)rfc822_skip_lwsp(&ctx->parser);
+ rfc822_skip_lwsp(&ctx->parser);
if (next_token(ctx, &value, &len) <= 0)
return FALSE;
@@ -197,7 +197,7 @@
if (!IS_TIME_SEP(*ctx->parser.data))
return FALSE;
ctx->parser.data++;
- (void)rfc822_skip_lwsp(&ctx->parser);
+ rfc822_skip_lwsp(&ctx->parser);
if (next_token(ctx, &value, &len) < 0 || len != 2 ||
!i_isdigit(value[0]) || !i_isdigit(value[1]))
@@ -208,7 +208,7 @@
if (ctx->parser.data != ctx->parser.end &&
IS_TIME_SEP(*ctx->parser.data)) {
ctx->parser.data++;
- (void)rfc822_skip_lwsp(&ctx->parser);
+ rfc822_skip_lwsp(&ctx->parser);
if (next_token(ctx, &value, &len) <= 0 || len != 2 ||
!i_isdigit(value[0]) || !i_isdigit(value[1]))
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/message-decoder.c Wed Jun 27 04:24:53 2012 +0300
@@ -102,7 +102,7 @@
value = t_str_new(64);
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
(void)rfc822_parse_mime_token(&parser, value);
ctx->content_type = CONTENT_TYPE_UNKNOWN;
@@ -137,7 +137,7 @@
return;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
str = t_str_new(64);
if (rfc822_parse_content_type(&parser, str) <= 0)
return;
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/message-id.c
--- a/src/lib-mail/message-id.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/message-id.c Wed Jun 27 04:24:53 2012 +0300
@@ -21,7 +21,7 @@
no-fold-literal = "[" *(dtext / quoted-pair) "]"
*/
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
if (*parser.data == '"')
ret = rfc822_parse_quoted_string(&parser, msgid);
@@ -34,7 +34,7 @@
return FALSE;
str_append_c(msgid, '@');
parser.data++;
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
if (rfc822_parse_dot_atom(&parser, msgid) <= 0)
return FALSE;
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/message-parser.c Wed Jun 27 04:24:53 2012 +0300
@@ -464,7 +464,7 @@
ctx->part_seen_content_type = TRUE;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
content_type = t_str_new(64);
if (rfc822_parse_content_type(&parser, content_type) < 0)
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/message-search.c
--- a/src/lib-mail/message-search.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/message-search.c Wed Jun 27 04:24:53 2012 +0300
@@ -55,7 +55,7 @@
string_t *content_type;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
content_type = t_str_new(64);
if (rfc822_parse_content_type(&parser, content_type) >= 0) {
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-mail/rfc822-parser.h
--- a/src/lib-mail/rfc822-parser.h Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-mail/rfc822-parser.h Wed Jun 27 04:24:53 2012 +0300
@@ -26,7 +26,8 @@
/* Parse comment. Assumes parser's data points to '(' */
int rfc822_skip_comment(struct rfc822_parser_context *ctx);
/* Skip LWSP if there is any */
-int rfc822_skip_lwsp(struct rfc822_parser_context *ctx);
+int ATTR_NOWARN_UNUSED_RESULT
+rfc822_skip_lwsp(struct rfc822_parser_context *ctx);
/* Stop at next non-atext char */
int rfc822_parse_atom(struct rfc822_parser_context *ctx, string_t *str);
/* Like parse_atom() but don't stop at '.' */
diff -r 128c598d2870 -r 096e4c4d62bb src/lib-storage/index/index-attachment.c
--- a/src/lib-storage/index/index-attachment.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib-storage/index/index-attachment.c Wed Jun 27 04:24:53 2012 +0300
@@ -98,7 +98,7 @@
string_t *content_type;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
- (void)rfc822_skip_lwsp(&parser);
+ rfc822_skip_lwsp(&parser);
T_BEGIN {
content_type = t_str_new(64);
diff -r 128c598d2870 -r 096e4c4d62bb src/lib/hash.c
--- a/src/lib/hash.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib/hash.c Wed Jun 27 04:24:53 2012 +0300
@@ -176,7 +176,7 @@
return TRUE;
}
-static struct hash_node *
+static struct hash_node * ATTR_NOWARN_UNUSED_RESULT
hash_table_insert_node(struct hash_table *table, void *key, void *value,
bool check_existing)
{
@@ -265,7 +265,7 @@
void hash_table_update(struct hash_table *table, void *key, void *value)
{
- (void)hash_table_insert_node(table, key, value, TRUE);
+ hash_table_insert_node(table, key, value, TRUE);
}
static void
@@ -438,16 +438,16 @@
for (i = 0; i < old_size; i++) {
node = &old_nodes[i];
if (node->key != NULL) {
- (void)hash_table_insert_node(table, node->key,
- node->value, FALSE);
+ hash_table_insert_node(table, node->key,
+ node->value, FALSE);
}
for (node = node->next; node != NULL; node = next) {
next = node->next;
if (node->key != NULL) {
- (void)hash_table_insert_node(table, node->key,
- node->value, FALSE);
+ hash_table_insert_node(table, node->key,
+ node->value, FALSE);
}
free_node(table, node);
}
diff -r 128c598d2870 -r 096e4c4d62bb src/lib/md4.c
--- a/src/lib/md4.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib/md4.c Wed Jun 27 04:24:53 2012 +0300
@@ -62,7 +62,8 @@
* This processes one or more 64-byte data blocks, but does NOT update
* the bit counters. There're no alignment requirements.
*/
-static const void *body(struct md4_context *ctx, const void *data, size_t size)
+static const void * ATTR_NOWARN_UNUSED_RESULT
+body(struct md4_context *ctx, const void *data, size_t size)
{
const unsigned char *ptr;
uint32_t a, b, c, d;
@@ -193,7 +194,7 @@
memcpy(&ctx->buffer[used], data, free);
data = (const unsigned char *) data + free;
size -= free;
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
}
if (size >= 64) {
@@ -217,7 +218,7 @@
if (free < 8) {
memset(&ctx->buffer[used], 0, free);
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
used = 0;
free = 64;
}
@@ -234,7 +235,7 @@
ctx->buffer[62] = ctx->hi >> 16;
ctx->buffer[63] = ctx->hi >> 24;
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
result[0] = ctx->a;
result[1] = ctx->a >> 8;
diff -r 128c598d2870 -r 096e4c4d62bb src/lib/md5.c
--- a/src/lib/md5.c Mon Jun 25 03:21:25 2012 +0300
+++ b/src/lib/md5.c Wed Jun 27 04:24:53 2012 +0300
@@ -66,7 +66,8 @@
* This processes one or more 64-byte data blocks, but does NOT update
* the bit counters. There're no alignment requirements.
*/
-static const void *body(struct md5_context *ctx, const void *data, size_t size)
+static const void * ATTR_NOWARN_UNUSED_RESULT
+body(struct md5_context *ctx, const void *data, size_t size)
{
const unsigned char *ptr;
uint_fast32_t a, b, c, d;
@@ -208,7 +209,7 @@
memcpy(&ctx->buffer[used], data, free);
data = (const unsigned char *) data + free;
size -= free;
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
}
if (size >= 64) {
@@ -232,7 +233,7 @@
if (free < 8) {
memset(&ctx->buffer[used], 0, free);
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
used = 0;
free = 64;
}
@@ -249,7 +250,7 @@
ctx->buffer[62] = ctx->hi >> 16;
ctx->buffer[63] = ctx->hi >> 24;
- (void)body(ctx, ctx->buffer, 64);
+ body(ctx, ctx->buffer, 64);
result[0] = ctx->a;
result[1] = ctx->a >> 8;
diff -r 128c598d2870 -r 096e4c4d62bb src/lib/ostream.c
More information about the dovecot-cvs
mailing list