dovecot-2.2: treewide - use of explicit NULL in pointer comparis...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 8 14:04:53 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/36c2611e053e
changeset: 17362:36c2611e053e
user:      Phil Carmody <phil at dovecot.fi>
date:      Thu May 08 15:53:27 2014 +0300
description:
treewide - use of explicit NULL in pointer comparisons rather than 0-alikes

Found by sparse.

diffstat:

 src/doveadm/dsync/dsync-mailbox-tree.c           |  6 +++---
 src/lib-imap/imap-url.c                          |  2 +-
 src/lib-index/mail-cache-fields.c                |  4 ++--
 src/lib-storage/index/maildir/maildir-keywords.c |  4 ++--
 src/lib-storage/index/maildir/maildir-save.c     |  3 ++-
 src/lib-storage/mail-search-build.c              |  2 +-
 6 files changed, 11 insertions(+), 10 deletions(-)

diffs (108 lines):

diff -r cb5b2a1579af -r 36c2611e053e src/doveadm/dsync/dsync-mailbox-tree.c
--- 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;
diff -r cb5b2a1579af -r 36c2611e053e src/lib-imap/imap-url.c
--- 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;
 
diff -r cb5b2a1579af -r 36c2611e053e src/lib-index/mail-cache-fields.c
--- 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) {
diff -r cb5b2a1579af -r 36c2611e053e src/lib-storage/index/maildir/maildir-keywords.c
--- 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;
 	}
 
diff -r cb5b2a1579af -r 36c2611e053e src/lib-storage/index/maildir/maildir-save.c
--- 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 {
diff -r cb5b2a1579af -r 36c2611e053e src/lib-storage/mail-search-build.c
--- 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";


More information about the dovecot-cvs mailing list