]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Try to avoid (void) casts by adding more ATTR_NOWARN_UNUSED_RESULT.
authorTimo Sirainen <tss@iki.fi>
Wed, 27 Jun 2012 01:24:53 +0000 (04:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 27 Jun 2012 01:24:53 +0000 (04:24 +0300)
14 files changed:
src/lib-imap/imap-bodystructure.c
src/lib-mail/message-date.c
src/lib-mail/message-decoder.c
src/lib-mail/message-id.c
src/lib-mail/message-parser.c
src/lib-mail/message-search.c
src/lib-mail/rfc822-parser.h
src/lib-storage/index/index-attachment.c
src/lib/hash.c
src/lib/md4.c
src/lib/md5.c
src/lib/ostream.c
src/plugins/fts/fts-build-mail.c
src/plugins/fts/fts-parser-script.c

index 5021016b4a36e3ab41716f636f5d134b8ed9ce12..589883e127abe9cf617928dedb121484d3fd7ab1 100644 (file)
@@ -44,7 +44,7 @@ static void parse_content_type(struct message_part_body_data *data,
        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 @@ static void parse_content_transfer_encoding(struct message_part_body_data *data,
        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 @@ static void parse_content_disposition(struct message_part_body_data *data,
        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 @@ static void parse_content_language(const unsigned char *value, size_t value_len,
        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) {
index aa90d5d5900d005cc43b70d121e97c6d54259d30..72e4a5f56ba0b397ca074869017fb383937ba4c3 100644 (file)
@@ -123,7 +123,7 @@ message_date_parser_tokens(struct message_date_parser_context *ctx,
        /* [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 @@ message_date_parser_tokens(struct message_date_parser_context *ctx,
                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 @@ message_date_parser_tokens(struct message_date_parser_context *ctx,
        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 @@ message_date_parser_tokens(struct message_date_parser_context *ctx,
        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]))
index 047bff4ee91d93f5cc300e6b435d6186eee1d19b..c2d11e2f50278a414498e7f07761e6543d071746 100644 (file)
@@ -102,7 +102,7 @@ parse_content_transfer_encoding(struct message_decoder_context *ctx,
        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 @@ parse_content_type(struct message_decoder_context *ctx,
                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;
index 420c3ef822303a5748c26158be220eee7dca73db..093ee5324358a0725534f25c0199310fd6794458 100644 (file)
@@ -21,7 +21,7 @@ static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid)
           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 @@ static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid)
                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;
index 75cbbb3de20402ee9053686394ff4c4ee1761d31..66fa6667df22b96ad2916bfe55d45a0f2c2a4974 100644 (file)
@@ -464,7 +464,7 @@ static void parse_content_type(struct message_parser_ctx *ctx,
        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)
index ff85676f6fd1551aec37eedabbf7a46ec1640702..4652732a9e2978a7aadbea7c9b6a9289481938c3 100644 (file)
@@ -55,7 +55,7 @@ static void parse_content_type(struct message_search_context *ctx,
        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) {
index 7d2b87e040b5176948e4c05ead2a8f29b34ab137..87e9aa23dc74e89823b6316573111c58c5fe02f4 100644 (file)
@@ -26,7 +26,8 @@ void rfc822_parser_init(struct rfc822_parser_context *ctx,
 /* 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 '.' */
index 4f9841efe5b51fbd8fe298ae4313673dd8107a82..ccdce454f3ae5bb3b8130a119912f28da34cec01 100644 (file)
@@ -98,7 +98,7 @@ static void parse_content_type(struct mail_save_context *ctx,
        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);
index b790093e61d2433dec2b1afd15098727d40872d4..124f103fc0430a71c061cc971f79e8c9caa85fd3 100644 (file)
@@ -176,7 +176,7 @@ bool hash_table_lookup_full(const struct hash_table *table,
        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_insert(struct hash_table *table, void *key, void *value)
 
 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 @@ static bool hash_table_resize(struct hash_table *table, bool grow)
        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);
                }
index 2a5a294ffdaf157aac9c034d922e40d9b73703dc..295567c87e8ccd159bbf49c35f82137f3e6a4212 100644 (file)
@@ -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 @@ void md4_update(struct md4_context *ctx, const void *data, size_t size)
                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 @@ void md4_final(struct md4_context *ctx, unsigned char result[MD4_RESULTLEN])
 
        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 @@ void md4_final(struct md4_context *ctx, unsigned char result[MD4_RESULTLEN])
        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;
index 3bd394c71ad9cdc286e424acd6b29b778181f765..5581d757bd17f961f5e55262afe49a8c6c765150 100644 (file)
@@ -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 @@ void md5_update(struct md5_context *ctx, const void *data, size_t size)
                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 @@ void md5_final(struct md5_context *ctx, unsigned char result[MD5_RESULTLEN])
 
        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 @@ void md5_final(struct md5_context *ctx, unsigned char result[MD5_RESULTLEN])
        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;
index 7adc950e655aedd2a5c426965b3c0dd5e347d9d7..83b565d7e69f3cb3759ade6a68affb21a031da2e 100644 (file)
@@ -213,7 +213,7 @@ void o_stream_nsend(struct ostream *stream, const void *data, size_t size)
        iov.iov_base = data;
        iov.iov_len = size;
 
-       (void)o_stream_nsendv(stream, &iov, 1);
+       o_stream_nsendv(stream, &iov, 1);
 }
 
 void o_stream_nsendv(struct ostream *stream, const struct const_iovec *iov,
index c6cec4314f459145afa246ec17855f74df6c6cdb..a60c1543a97862626d25a015a06110308f9cbce6 100644 (file)
@@ -37,7 +37,7 @@ static void fts_build_parse_content_type(struct fts_mail_build_context *ctx,
        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);
index 4edc2b50a012ef3dc74bcf7ee95e062c2d0ab5d2..534fd1216fa115bb4b7b117e47af40f7fcd6344d 100644 (file)
@@ -162,7 +162,7 @@ static void parse_content_disposition(const char *content_disposition,
 
        rfc822_parser_init(&parser, (const unsigned char *)content_disposition,
                           strlen(content_disposition), NULL);
-       (void)rfc822_skip_lwsp(&parser);
+       rfc822_skip_lwsp(&parser);
 
        /* type; param; param; .. */
        str = t_str_new(32);