Mercurial > dovecot > core-2.2
changeset 17362:36c2611e053e
treewide - use of explicit NULL in pointer comparisons rather than 0-alikes
Found by sparse.
author | Phil Carmody <phil@dovecot.fi> |
---|---|
date | Thu, 08 May 2014 15:53:27 +0300 |
parents | cb5b2a1579af |
children | 791ec610422c |
files | src/doveadm/dsync/dsync-mailbox-tree.c src/lib-imap/imap-url.c src/lib-index/mail-cache-fields.c src/lib-storage/index/maildir/maildir-keywords.c src/lib-storage/index/maildir/maildir-save.c src/lib-storage/mail-search-build.c |
diffstat | 6 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-mailbox-tree.c Thu May 08 17:01:26 2014 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-tree.c Thu May 08 15:53:27 2014 +0300 @@ -67,7 +67,7 @@ const char *const *path; path = t_strsplit(full_name, tree->sep_str); - for (; *path != '\0' && node != NULL; path++) + for (; *path != NULL && node != NULL; path++) node = dsync_mailbox_node_find(node->first_child, *path); } T_END; return node; @@ -106,14 +106,14 @@ /* find the existing part */ path = t_strsplit(full_name, tree->sep_str); - for (; *path != '\0'; path++) { + for (; *path != NULL; path++) { parent = node; node = dsync_mailbox_node_find(node->first_child, *path); if (node == NULL) break; } /* create the rest */ - for (; *path != '\0'; path++) { + for (; *path != NULL; path++) { node = p_new(tree->pool, struct dsync_mailbox_node, 1); node->name = p_strdup(tree->pool, *path); node->ns = parent->ns;
--- a/src/lib-imap/imap-url.c Thu May 08 17:01:26 2014 +0300 +++ b/src/lib-imap/imap-url.c Thu May 08 15:53:27 2014 +0300 @@ -503,7 +503,7 @@ segment = path; /* Resolve relative URI path; determine what to copy from the base URI */ - if (url != NULL && url_parser->base != 0 && relative > 0) { + if (url != NULL && url_parser->base != NULL && relative > 0) { struct imap_url *base = url_parser->base; int rel = relative;
--- a/src/lib-index/mail-cache-fields.c Thu May 08 17:01:26 2014 +0300 +++ b/src/lib-index/mail-cache-fields.c Thu May 08 15:53:27 2014 +0300 @@ -490,7 +490,7 @@ int ret = 0; if (mail_cache_header_fields_read(cache) < 0 || - mail_cache_header_fields_get_offset(cache, &offset, FALSE) < 0) + mail_cache_header_fields_get_offset(cache, &offset, NULL) < 0) return -1; buffer = buffer_create_dynamic(pool_datastack_create(), 256); @@ -596,7 +596,7 @@ int mail_cache_header_fields_get_next_offset(struct mail_cache *cache, uint32_t *offset_r) { - if (mail_cache_header_fields_get_offset(cache, offset_r, FALSE) < 0) + if (mail_cache_header_fields_get_offset(cache, offset_r, NULL) < 0) return -1; if (*offset_r == 0) {
--- a/src/lib-storage/index/maildir/maildir-keywords.c Thu May 08 17:01:26 2014 +0300 +++ b/src/lib-storage/index/maildir/maildir-keywords.c Thu May 08 15:53:27 2014 +0300 @@ -200,7 +200,7 @@ void *value; value = hash_table_lookup(mk->hash, name); - if (value == 0) { + if (value == NULL) { if (mk->synced) return 0; @@ -209,7 +209,7 @@ i_assert(mk->synced); value = hash_table_lookup(mk->hash, name); - if (value == 0) + if (value == NULL) return 0; }
--- a/src/lib-storage/index/maildir/maildir-save.c Thu May 08 17:01:26 2014 +0300 +++ b/src/lib-storage/index/maildir/maildir-save.c Thu May 08 15:53:27 2014 +0300 @@ -897,7 +897,8 @@ array_append(&files, &mf, 1); array_sort(&files, maildir_filename_dest_basename_cmp); - new_changed = cur_changed = FALSE; prev_mf = FALSE; + new_changed = cur_changed = FALSE; + prev_mf = NULL; array_foreach(&files, mfp) { mf = *mfp; T_BEGIN {
--- a/src/lib-storage/mail-search-build.c Thu May 08 17:01:26 2014 +0300 +++ b/src/lib-storage/mail-search-build.c Thu May 08 15:53:27 2014 +0300 @@ -230,7 +230,7 @@ string_t *utf8 = t_str_new(128); enum charset_result result; - if (charset_to_utf8_str(ctx->charset, 0, + if (charset_to_utf8_str(ctx->charset, NULL, input, utf8, &result) < 0) { /* unknown charset */ ctx->_error = "Unknown charset";