changeset 7561:1a58b18652a6 HEAD

Avoid using shadow variables. Unfortunately -Wshadow also complains about index variable conflicting with index(), which is used in way too many places to change.
author Timo Sirainen <tss@iki.fi>
date Tue, 27 May 2008 02:09:47 +0300
parents fedeb23a3d53
children 4c702defc245
files src/auth/auth-master-listener.c src/auth/db-passwd-file.c src/auth/userdb-nss.c src/deliver/auth-client.c src/deliver/deliver.c src/deliver/duplicate.c src/deliver/duplicate.h src/imap/imap-fetch-body.c src/imap/imap-thread.c src/lib-imap/imap-date.c src/lib-imap/imap-date.h src/lib-index/mail-cache-compress.c src/lib-index/mail-index-map.c src/lib-mail/mbox-from.c src/lib-mail/mbox-from.h src/lib-mail/message-date.c src/lib-mail/message-date.h src/lib-storage/index/dbox/dbox-index.c src/lib-storage/index/index-sync.c src/lib-storage/index/mbox/mbox-sync.c src/lib-storage/list/mailbox-list-fs-iter.c src/lib/module-dir.c src/lib/restrict-access.c src/master/dict-process.c src/master/listener.c src/master/mail-process.c src/master/mail-process.h src/master/master-settings.c src/plugins/fts-squat/squat-trie.c src/plugins/quota/quota-fs.c src/util/idxview.c src/util/rawlog.c
diffstat 32 files changed, 191 insertions(+), 183 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-master-listener.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/auth/auth-master-listener.c	Tue May 27 02:09:47 2008 +0300
@@ -40,16 +40,16 @@
 }
 
 static void
-auth_master_listener_socket_free(struct auth_master_listener_socket *socket)
+auth_master_listener_socket_free(struct auth_master_listener_socket *s)
 {
-	if (socket->path != NULL) {
-		(void)unlink(socket->path);
-		i_free(socket->path);
+	if (s->path != NULL) {
+		(void)unlink(s->path);
+		i_free(s->path);
 	}
 
-	io_remove(&socket->io);
-	net_disconnect(socket->fd);
-	i_free(socket);
+	io_remove(&s->io);
+	net_disconnect(s->fd);
+	i_free(s);
 }
 
 void auth_master_listener_destroy(struct auth_master_listener *listener)
--- a/src/auth/db-passwd-file.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/auth/db-passwd-file.c	Tue May 27 02:09:47 2008 +0300
@@ -385,15 +385,12 @@
 	struct passwd_file *pw;
 	struct passwd_user *pu;
 	const struct var_expand_table *table;
-	string_t *username;
+	string_t *username, *dest;
 	const char *path;
 
 	if (!db->vars)
 		pw = db->default_file;
 	else {
-		const struct var_expand_table *table;
-		string_t *dest;
-
 		table = auth_request_get_var_expand_table(request, path_fix);
 		dest = t_str_new(256);
 		var_expand(dest, db->path, table);
--- a/src/auth/userdb-nss.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/auth/userdb-nss.c	Tue May 27 02:09:47 2008 +0300
@@ -130,13 +130,13 @@
 static void userdb_nss_deinit(struct userdb_module *_module)
 {
 	struct nss_userdb_module *module = (struct nss_userdb_module *)_module;
-	void (*endpwent)(void);
+	void (*mod_endpwent)(void);
+	const char *symbol;
 
-	endpwent = module_get_symbol(&module->nss_module,
-				     t_strdup_printf("_nss_%s_endpwent",
-						     module->nss_module.name));
-	if (endpwent != NULL)
-		endpwent();
+	symbol = t_strdup_printf("_nss_%s_endpwent", module->nss_module.name);
+	mod_endpwent = module_get_symbol(&module->nss_module, symbol);
+	if (mod_endpwent != NULL)
+		mod_endpwent();
 }
 
 struct userdb_module_interface userdb_nss = {
--- a/src/deliver/auth-client.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/deliver/auth-client.c	Tue May 27 02:09:47 2008 +0300
@@ -95,7 +95,7 @@
 	const char *const *tmp, *extra_groups;
 	uid_t uid = 0;
 	gid_t gid = 0;
-	const char *chroot = getenv("MAIL_CHROOT");
+	const char *chroot_dir = getenv("MAIL_CHROOT");
 	const char *home_dir = NULL;
 	bool debug = getenv("DEBUG") != NULL;
 	unsigned int len;
@@ -121,7 +121,7 @@
 				return_value = EX_TEMPFAIL;
 			}
 		} else if (strncmp(*tmp, "chroot=", 7) == 0) {
-			chroot = *tmp + 7;
+			chroot_dir = *tmp + 7;
 		} else {
 			char *field = i_strdup(*tmp);
 
@@ -162,15 +162,15 @@
 	if (conn->euid == 0 || getegid() != gid)
 		env_put(t_strconcat("RESTRICT_SETGID=", dec2str(gid), NULL));
 
-	if (chroot != NULL) {
-		len = strlen(chroot);
-		if (len > 2 && strcmp(chroot + len - 2, "/.") == 0 &&
+	if (chroot_dir != NULL) {
+		len = strlen(chroot_dir);
+		if (len > 2 && strcmp(chroot_dir + len - 2, "/.") == 0 &&
 		    home_dir != NULL &&
-		    strncmp(home_dir, chroot, len - 2) == 0) {
+		    strncmp(home_dir, chroot_dir, len - 2) == 0) {
 			/* strip chroot dir from home dir */
 			home_dir += len - 2;
 		}
-		env_put(t_strconcat("RESTRICT_CHROOT=", chroot, NULL));
+		env_put(t_strconcat("RESTRICT_CHROOT=", chroot_dir, NULL));
 	}
 	if (home_dir != NULL)
 		env_put(t_strconcat("HOME=", home_dir, NULL));
--- a/src/deliver/deliver.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/deliver/deliver.c	Tue May 27 02:09:47 2008 +0300
@@ -711,7 +711,7 @@
 	const char *config_path = DEFAULT_CONFIG_FILE;
 	const char *mailbox = "INBOX";
 	const char *auth_socket;
-	const char *home, *destaddr, *user, *value, *error;
+	const char *home, *destaddr, *user, *value, *errstr;
 	ARRAY_TYPE(string) extra_fields;
 	struct mail_namespace *ns, *raw_ns;
 	struct mail_storage *storage;
@@ -938,8 +938,8 @@
 	raw_ns = mail_namespaces_init_empty(namespace_pool);
 	raw_ns->flags |= NAMESPACE_FLAG_INTERNAL;
 	if (mail_storage_create(raw_ns, "raw", "/tmp", user,
-				0, FILE_LOCK_METHOD_FCNTL, &error) < 0)
-		i_fatal("Couldn't create internal raw storage: %s", error);
+				0, FILE_LOCK_METHOD_FCNTL, &errstr) < 0)
+		i_fatal("Couldn't create internal raw storage: %s", errstr);
 	input = create_raw_stream(0, &mtime);
 	box = mailbox_open(raw_ns->storage, "Dovecot Delivery Mail", input,
 			   MAILBOX_OPEN_NO_INDEX_FILES);
@@ -991,7 +991,6 @@
 	if (ret < 0 ) {
 		const char *error_string;
 		enum mail_error error;
-		int ret;
 
 		if (storage == NULL) {
 			/* This shouldn't happen */
--- a/src/deliver/duplicate.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/deliver/duplicate.c	Tue May 27 02:09:47 2008 +0300
@@ -245,7 +245,7 @@
 }
 
 void duplicate_mark(const void *id, size_t id_size,
-                    const char *user, time_t time)
+                    const char *user, time_t timestamp)
 {
 	struct duplicate *d;
 	void *new_id;
@@ -260,7 +260,7 @@
 	d->id = new_id;
 	d->id_size = id_size;
 	d->user = p_strdup(duplicate_file->pool, user);
-	d->time = time;
+	d->time = timestamp;
 
 	duplicate_file->changed = TRUE;
 	hash_insert(duplicate_file->hash, d, d);
--- a/src/deliver/duplicate.h	Tue May 27 00:16:12 2008 +0300
+++ b/src/deliver/duplicate.h	Tue May 27 02:09:47 2008 +0300
@@ -5,7 +5,7 @@
 
 int duplicate_check(const void *id, size_t id_size, const char *user);
 void duplicate_mark(const void *id, size_t id_size,
-                    const char *user, time_t time);
+                    const char *user, time_t timestamp);
 
 void duplicate_flush(void);
 
--- a/src/imap/imap-fetch-body.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/imap/imap-fetch-body.c	Tue May 27 02:09:47 2008 +0300
@@ -41,7 +41,7 @@
 	struct message_size pos;
 };
 
-static struct partial_cache partial = { 0, 0, 0, 0, { 0, 0, 0 } };
+static struct partial_cache last_partial = { 0, 0, 0, 0, { 0, 0, 0 } };
 
 static bool seek_partial(unsigned int select_counter, unsigned int uid,
 			 struct partial_cache *partial, struct istream *stream,
@@ -224,10 +224,10 @@
 
 	ctx->cur_offset += ret;
 	if (ctx->update_partial) {
-		partial.cr_skipped = ctx->skip_cr != 0;
-		partial.pos.physical_size =
-			ctx->cur_input->v_offset - partial.physical_start;
-		partial.pos.virtual_size += ret;
+		last_partial.cr_skipped = ctx->skip_cr != 0;
+		last_partial.pos.physical_size =
+			ctx->cur_input->v_offset - last_partial.physical_start;
+		last_partial.pos.virtual_size += ret;
 	}
 
 	return ctx->cur_offset == ctx->cur_size;
@@ -312,7 +312,7 @@
 	} else {
 		ctx->skip_cr =
 			seek_partial(ctx->select_counter, ctx->cur_mail->uid,
-				     &partial, ctx->cur_input, body->skip);
+				     &last_partial, ctx->cur_input, body->skip);
 	}
 
 	return fetch_stream(ctx, size);
--- a/src/imap/imap-thread.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/imap/imap-thread.c	Tue May 27 02:09:47 2008 +0300
@@ -939,8 +939,7 @@
 	/* (2) save root nodes and drop the msgids */
 	iter = hash_iterate_init(ctx->msgid_hash);
 	while (hash_iterate(iter, &key, &value)) {
-		struct node *node = value;
-
+		node = value;
 		if (node->parent == NULL)
 			add_root(ctx, node);
 	}
--- a/src/lib-imap/imap-date.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-imap/imap-date.c	Tue May 27 02:09:47 2008 +0300
@@ -105,7 +105,7 @@
 	return FALSE;
 }
 
-bool imap_parse_date(const char *str, time_t *time)
+bool imap_parse_date(const char *str, time_t *timestamp_r)
 {
 	struct tm tm;
 
@@ -114,11 +114,12 @@
 		return FALSE;
 
 	tm.tm_isdst = -1;
-	(void)imap_mktime(&tm, time);
+	(void)imap_mktime(&tm, timestamp_r);
 	return TRUE;
 }
 
-bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset)
+bool imap_parse_datetime(const char *str, time_t *timestamp_r,
+			 int *timezone_offset_r)
 {
 	struct tm tm;
 
@@ -149,22 +150,22 @@
 	str += 3;
 
 	/* timezone */
-	*timezone_offset = parse_timezone(str);
+	*timezone_offset_r = parse_timezone(str);
 
 	tm.tm_isdst = -1;
-	if (imap_mktime(&tm, time))
-		*time -= *timezone_offset * 60;
+	if (imap_mktime(&tm, timestamp_r))
+		*timestamp_r -= *timezone_offset_r * 60;
 	return TRUE;
 }
 
-const char *imap_to_datetime(time_t time)
+const char *imap_to_datetime(time_t timestamp)
 {
 	char *buf;
 	struct tm *tm;
 	int timezone_offset, year;
 
-	tm = localtime(&time);
-	timezone_offset = utc_offset(tm, time);
+	tm = localtime(&timestamp);
+	timezone_offset = utc_offset(tm, timestamp);
 
 	/* @UNSAFE: but faster than t_strdup_printf() call.. */
 	buf = t_malloc(27);
--- a/src/lib-imap/imap-date.h	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-imap/imap-date.h	Tue May 27 02:09:47 2008 +0300
@@ -8,10 +8,11 @@
    If date is too low or too high to fit to time_t, it's set to lowest/highest
    allowed value. This allows you to use the value directly for comparing
    timestamps. */
-bool imap_parse_date(const char *str, time_t *time);
-bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset);
+bool imap_parse_date(const char *str, time_t *timestamp_r);
+bool imap_parse_datetime(const char *str, time_t *timestamp_r,
+			 int *timezone_offset_r);
 
 /* Returns given UTC time in local timezone. */
-const char *imap_to_datetime(time_t time);
+const char *imap_to_datetime(time_t timestamp);
 
 #endif
--- a/src/lib-index/mail-cache-compress.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-index/mail-cache-compress.c	Tue May 27 02:09:47 2008 +0300
@@ -199,28 +199,28 @@
 		used_fields_count = i;
 	} else {
 		for (i = used_fields_count = 0; i < orig_fields_count; i++) {
-			struct mail_cache_field_private *field =
+			struct mail_cache_field_private *priv =
 				&cache->fields[i];
 			enum mail_cache_decision_type dec =
-				field->field.decision;
+				priv->field.decision;
 
 			/* if the decision isn't forced and this field hasn't
 			   been accessed for a while, drop it */
 			if ((dec & MAIL_CACHE_DECISION_FORCED) == 0 &&
-			    (time_t)field->last_used < max_drop_time &&
-			    !field->adding) {
+			    (time_t)priv->last_used < max_drop_time &&
+			    !priv->adding) {
 				dec = MAIL_CACHE_DECISION_NO;
-				field->field.decision = dec;
+				priv->field.decision = dec;
 			}
 
 			/* drop all fields we don't want */
 			if ((dec & ~MAIL_CACHE_DECISION_FORCED) ==
-			    MAIL_CACHE_DECISION_NO && !field->adding) {
-				field->used = FALSE;
-				field->last_used = 0;
+			    MAIL_CACHE_DECISION_NO && !priv->adding) {
+				priv->used = FALSE;
+				priv->last_used = 0;
 			}
 
-			ctx.field_file_map[i] = !field->used ?
+			ctx.field_file_map[i] = !priv->used ?
 				(uint32_t)-1 : used_fields_count++;
 		}
 	}
--- a/src/lib-index/mail-index-map.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-index/mail-index-map.c	Tue May 27 02:09:47 2008 +0300
@@ -331,11 +331,11 @@
 	for (i = 0; i < array_count(&map->keyword_idx_map); i++) {
 		const char *keyword = name + kw_rec[i].name_offset;
 		const unsigned int *old_idx;
-		unsigned int idx;
+		unsigned int kw_idx;
 
 		old_idx = array_idx(&map->keyword_idx_map, i);
-		if (!mail_index_keyword_lookup(index, keyword, &idx) ||
-		    idx != *old_idx) {
+		if (!mail_index_keyword_lookup(index, keyword, &kw_idx) ||
+		    kw_idx != *old_idx) {
 			mail_index_set_error(index, "Corrupted index file %s: "
 					     "Keywords changed unexpectedly",
 					     index->filepath);
@@ -347,7 +347,7 @@
 	i = array_count(&map->keyword_idx_map);
 	for (; i < kw_hdr->keywords_count; i++) {
 		const char *keyword = name + kw_rec[i].name_offset;
-		unsigned int idx;
+		unsigned int kw_idx;
 
 		if (*keyword == '\0') {
 			mail_index_set_error(index, "Corrupted index file %s: "
@@ -355,8 +355,8 @@
 				index->filepath);
 			return -1;
 		}
-		mail_index_keyword_lookup_or_create(index, keyword, &idx);
-		array_append(&map->keyword_idx_map, &idx, 1);
+		mail_index_keyword_lookup_or_create(index, keyword, &kw_idx);
+		array_append(&map->keyword_idx_map, &kw_idx, 1);
 	}
 	return 0;
 }
--- a/src/lib-mail/mbox-from.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-mail/mbox-from.c	Tue May 27 02:09:47 2008 +0300
@@ -54,7 +54,7 @@
 {
 	const unsigned char *msg_start, *sender_end, *msg_end;
 	struct tm tm;
-	int esc, alt_stamp, timezone = 0, seen_timezone = FALSE;
+	int esc, alt_stamp, timezone_secs = 0, seen_timezone = FALSE;
 	time_t t;
 
 	*time_r = (time_t)-1;
@@ -198,9 +198,9 @@
 		   i_isdigit(msg[3]) && i_isdigit(msg[4]) && msg[5] == ' ') {
 		/* numeric timezone, use it */
                 seen_timezone = TRUE;
-		timezone = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
+		timezone_secs = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
 			(msg[3]-'0') * 10 + (msg[4]-'0');
-		if (msg[0] == '-') timezone = -timezone;
+		if (msg[0] == '-') timezone_secs = -timezone_secs;
 		msg += 6;
 	}
 
@@ -217,9 +217,9 @@
 	    i_isdigit(msg[2]) && i_isdigit(msg[3]) &&
 	    i_isdigit(msg[4]) && i_isdigit(msg[5])) {
 		seen_timezone = TRUE;
-		timezone = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
+		timezone_secs = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
 			(msg[4]-'0') * 10 + (msg[5]-'0');
-		if (msg[1] == '-') timezone = -timezone;
+		if (msg[1] == '-') timezone_secs = -timezone_secs;
 	}
 
 	if (seen_timezone) {
@@ -227,7 +227,7 @@
 		if (t == (time_t)-1)
 			return -1;
 
-		t -= timezone;
+		t -= timezone_secs;
 		*time_r = t;
 	} else {
 		/* assume local timezone */
@@ -238,7 +238,7 @@
 	return 0;
 }
 
-const char *mbox_from_create(const char *sender, time_t time)
+const char *mbox_from_create(const char *sender, time_t timestamp)
 {
 	string_t *str;
 	struct tm *tm;
@@ -251,7 +251,7 @@
 
 	/* we could use simply asctime(), but i18n etc. may break it.
 	   Example: "Thu Nov 29 22:33:52 2001" */
-	tm = localtime(&time);
+	tm = localtime(&timestamp);
 
 	/* week day */
 	str_append(str, weekdays[tm->tm_wday]);
--- a/src/lib-mail/mbox-from.h	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-mail/mbox-from.h	Tue May 27 02:09:47 2008 +0300
@@ -7,6 +7,6 @@
 		    time_t *time_r, char **sender_r);
 /* Return a mbox-compatible From_-line using given sender and time.
    The returned string begins with "From ". */
-const char *mbox_from_create(const char *sender, time_t time);
+const char *mbox_from_create(const char *sender, time_t timestamp);
 
 #endif
--- a/src/lib-mail/message-date.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-mail/message-date.c	Tue May 27 02:09:47 2008 +0300
@@ -105,8 +105,9 @@
 	return ret < 0 ? -1 : *value_len > 0;
 }
 
-static bool message_date_parser_tokens(struct message_date_parser_context *ctx,
-				       time_t *time, int *timezone_offset)
+static bool
+message_date_parser_tokens(struct message_date_parser_context *ctx,
+			   time_t *timestamp_r, int *timezone_offset_r)
 {
 	struct tm tm;
 	const unsigned char *value;
@@ -212,24 +213,24 @@
 		return FALSE;
 	if (ret == 0) {
 		/* missing timezone */
-		*timezone_offset = 0;
+		*timezone_offset_r = 0;
 	} else {
 		/* timezone */
-		*timezone_offset = parse_timezone(value, len);
+		*timezone_offset_r = parse_timezone(value, len);
 	}
 
 	tm.tm_isdst = -1;
-	*time = utc_mktime(&tm);
-	if (*time == (time_t)-1)
+	*timestamp_r = utc_mktime(&tm);
+	if (*timestamp_r == (time_t)-1)
 		return FALSE;
 
-	*time -= *timezone_offset * 60;
+	*timestamp_r -= *timezone_offset_r * 60;
 
 	return TRUE;
 }
 
 bool message_date_parse(const unsigned char *data, size_t size,
-		       time_t *time, int *timezone_offset)
+			time_t *timestamp_r, int *timezone_offset_r)
 {
 	bool success;
 
@@ -238,21 +239,21 @@
 
 		rfc822_parser_init(&ctx.parser, data, size, NULL);
 		ctx.str = t_str_new(128);
-		success = message_date_parser_tokens(&ctx, time,
-						     timezone_offset);
+		success = message_date_parser_tokens(&ctx, timestamp_r,
+						     timezone_offset_r);
 	} T_END;
 
 	return success;
 }
 
-const char *message_date_create(time_t time)
+const char *message_date_create(time_t timestamp)
 {
 	struct tm *tm;
 	int offset;
 	bool negative;
 
-	tm = localtime(&time);
-	offset = utc_offset(tm, time);
+	tm = localtime(&timestamp);
+	offset = utc_offset(tm, timestamp);
 	if (offset >= 0)
 		negative = FALSE;
 	else {
--- a/src/lib-mail/message-date.h	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-mail/message-date.h	Tue May 27 02:09:47 2008 +0300
@@ -4,9 +4,9 @@
 /* Parses RFC2822 date/time string. timezone_offset is filled with the
    timezone's difference to UTC in minutes. */
 bool message_date_parse(const unsigned char *data, size_t size,
-			time_t *time, int *timezone_offset);
+			time_t *timestamp_r, int *timezone_offset_r);
 
 /* Create RFC2822 date/time string from given time in local timezone. */
-const char *message_date_create(time_t time);
+const char *message_date_create(time_t timestamp);
 
 #endif
--- a/src/lib-storage/index/dbox/dbox-index.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-storage/index/dbox/dbox-index.c	Tue May 27 02:09:47 2008 +0300
@@ -155,11 +155,11 @@
 				   struct dbox_index_file_header *hdr)
 {
 	if (index->uid_validity == 0) {
-		const struct mail_index_header *hdr;
+		const struct mail_index_header *idx_hdr;
 
-		hdr = mail_index_get_header(index->mbox->ibox.view);
-		index->uid_validity = hdr->uid_validity != 0 ?
-			hdr->uid_validity : (uint32_t)ioloop_time;
+		idx_hdr = mail_index_get_header(index->mbox->ibox.view);
+		index->uid_validity = idx_hdr->uid_validity != 0 ?
+			idx_hdr->uid_validity : (uint32_t)ioloop_time;
 	}
 
 	memset(hdr, ' ', sizeof(*hdr));
--- a/src/lib-storage/index/index-sync.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-storage/index/index-sync.c	Tue May 27 02:09:47 2008 +0300
@@ -118,12 +118,12 @@
 
 static void index_view_sync_recs_get(struct index_mailbox_sync_context *ctx)
 {
-	struct mail_index_view_sync_rec sync;
+	struct mail_index_view_sync_rec sync_rec;
 	uint32_t seq1, seq2;
 
 	i_array_init(&ctx->flag_updates, 128);
-	while (mail_index_view_sync_next(ctx->sync_ctx, &sync)) {
-		switch (sync.type) {
+	while (mail_index_view_sync_next(ctx->sync_ctx, &sync_rec)) {
+		switch (sync_rec.type) {
 		case MAIL_INDEX_SYNC_TYPE_APPEND:
 			/* not interested */
 			break;
@@ -135,7 +135,8 @@
 		case MAIL_INDEX_SYNC_TYPE_KEYWORD_REMOVE:
 		case MAIL_INDEX_SYNC_TYPE_KEYWORD_RESET:
 			if (mail_index_lookup_seq_range(ctx->ibox->view,
-							sync.uid1, sync.uid2,
+							sync_rec.uid1,
+							sync_rec.uid2,
 							&seq1, &seq2)) {
 				seq_range_array_add_range(&ctx->flag_updates,
 							  seq1, seq2);
--- a/src/lib-storage/index/mbox/mbox-sync.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Tue May 27 02:09:47 2008 +0300
@@ -1656,7 +1656,6 @@
 		   before index syncing is started to avoid deadlocks, so we
 		   don't have much choice either (well, easy ones anyway). */
 		int lock_type = mbox->mbox_readonly ? F_RDLCK : F_WRLCK;
-		int ret;
 
 		if ((ret = mbox_lock(mbox, lock_type, &lock_id)) <= 0) {
 			if (ret == 0 || lock_type == F_RDLCK)
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Tue May 27 02:09:47 2008 +0300
@@ -574,9 +574,9 @@
 
 	if (dir->dirp != NULL) {
 		if (dir->next_entry != NULL) {
-			const struct list_dir_entry *ret = dir->next_entry;
+			const struct list_dir_entry *entry = dir->next_entry;
 			dir->next_entry = NULL;
-			return ret;
+			return entry;
 		}
 		d = readdir(dir->dirp);
 		if (d == NULL)
--- a/src/lib/module-dir.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib/module-dir.c	Tue May 27 02:09:47 2008 +0300
@@ -250,9 +250,9 @@
 
 	module_pos = &modules;
 	for (i = 0; i < count; i++) T_BEGIN {
-		const char *name = names_p[i];
 		const char *path, *stripped_name;
 
+		name = names_p[i];
 		stripped_name = module_file_get_name(name);
 		if (!module_want_load(module_names_arr, stripped_name))
 			module = NULL;
--- a/src/lib/restrict-access.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/lib/restrict-access.c	Tue May 27 02:09:47 2008 +0300
@@ -12,8 +12,9 @@
 #include <time.h>
 #include <grp.h>
 
-static gid_t primary_gid = (gid_t)-1, privileged_gid = (gid_t)-1;
-static bool using_priv_gid = FALSE;
+static gid_t process_primary_gid = (gid_t)-1;
+static gid_t process_privileged_gid = (gid_t)-1;
+static bool process_using_priv_gid = FALSE;
 
 void restrict_access_set_env(const char *user, uid_t uid,
 			     gid_t gid, gid_t privileged_gid,
@@ -160,7 +161,7 @@
 	/* if we're using a privileged GID, we can temporarily drop our
 	   effective GID. we still want to be able to use its privileges,
 	   so add it to supplementary groups. */
-	add_primary_gid = privileged_gid != (gid_t)-1;
+	add_primary_gid = process_privileged_gid != (gid_t)-1;
 
 	tmp = extra_groups == NULL ? &empty :
 		t_strsplit_spaces(extra_groups, ", ");
@@ -171,7 +172,7 @@
 				       have_root_group);
 		/* see if the list already contains the primary GID */
 		for (i = 0; i < gid_count; i++) {
-			if (gid_list[i] == primary_gid) {
+			if (gid_list[i] == process_primary_gid) {
 				add_primary_gid = FALSE;
 				break;
 			}
@@ -184,7 +185,7 @@
 		/* Some OSes don't like an empty groups list,
 		   so use the primary GID as the only one. */
 		gid_list = t_new(gid_t, 2);
-		gid_list[0] = primary_gid;
+		gid_list[0] = process_primary_gid;
 		gid_count = 1;
 		add_primary_gid = FALSE;
 	}
@@ -195,11 +196,11 @@
 		memcpy(gid_list2, gid_list, gid_count * sizeof(gid_t));
 		for (; *tmp != NULL; tmp++) {
 			gid = get_group_id(*tmp);
-			if (gid != primary_gid)
+			if (gid != process_primary_gid)
 				gid_list2[gid_count++] = gid;
 		}
 		if (add_primary_gid)
-			gid_list2[gid_count++] = primary_gid;
+			gid_list2[gid_count++] = process_primary_gid;
 		gid_list = gid_list2;
 	}
 
@@ -224,28 +225,30 @@
 
 	/* set the primary/privileged group */
 	env = getenv("RESTRICT_SETGID");
-	primary_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
+	process_primary_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
 		(gid_t)strtoul(env, NULL, 10);
 	env = getenv("RESTRICT_SETGID_PRIV");
-	privileged_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
+	process_privileged_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
 		(gid_t)strtoul(env, NULL, 10);
 
-	have_root_group = primary_gid == 0;
-	if (primary_gid != (gid_t)-1 || privileged_gid != (gid_t)-1) {
-		if (primary_gid == (gid_t)-1)
-			primary_gid = getegid();
-		restrict_init_groups(primary_gid, privileged_gid);
+	have_root_group = process_primary_gid == 0;
+	if (process_primary_gid != (gid_t)-1 ||
+	    process_privileged_gid != (gid_t)-1) {
+		if (process_primary_gid == (gid_t)-1)
+			process_primary_gid = getegid();
+		restrict_init_groups(process_primary_gid,
+				     process_privileged_gid);
 	} else {
-		if (primary_gid == (gid_t)-1)
-			primary_gid = getegid();
+		if (process_primary_gid == (gid_t)-1)
+			process_primary_gid = getegid();
 	}
 
 	/* set system user's groups */
 	env = getenv("RESTRICT_USER");
 	if (env != NULL && *env != '\0' && is_root) {
-		if (initgroups(env, primary_gid) < 0) {
+		if (initgroups(env, process_primary_gid) < 0) {
 			i_fatal("initgroups(%s, %s) failed: %m",
-				env, dec2str(primary_gid));
+				env, dec2str(process_primary_gid));
 		}
 		preserve_groups = TRUE;
 	}
@@ -303,18 +306,18 @@
 	env = getenv("RESTRICT_GID_FIRST");
 	if (env != NULL && atoi(env) != 0)
 		allow_root_gid = FALSE;
-	else if (primary_gid == 0 || privileged_gid == 0)
+	else if (process_primary_gid == 0 || process_privileged_gid == 0)
 		allow_root_gid = TRUE;
 	else
 		allow_root_gid = FALSE;
 
 	if (!allow_root_gid && uid != 0) {
 		if (getgid() == 0 || getegid() == 0 || setgid(0) == 0) {
-			if (primary_gid == 0)
+			if (process_primary_gid == 0)
 				i_fatal("GID 0 isn't permitted");
 			i_fatal("We couldn't drop root group privileges "
 				"(wanted=%s, gid=%s, egid=%s)",
-				dec2str(primary_gid),
+				dec2str(process_primary_gid),
 				dec2str(getgid()), dec2str(getegid()));
 		}
 	}
@@ -323,7 +326,7 @@
 	env_put("RESTRICT_USER=");
 	env_put("RESTRICT_CHROOT=");
 	env_put("RESTRICT_SETUID=");
-	if (privileged_gid == (gid_t)-1) {
+	if (process_privileged_gid == (gid_t)-1) {
 		/* if we're dropping privileges before executing and
 		   a privileged group is set, the groups must be fixed
 		   after exec */
@@ -337,29 +340,29 @@
 
 int restrict_access_use_priv_gid(void)
 {
-	i_assert(!using_priv_gid);
+	i_assert(!process_using_priv_gid);
 
-	if (privileged_gid == (gid_t)-1)
+	if (process_privileged_gid == (gid_t)-1)
 		return 0;
-	if (setegid(privileged_gid) < 0) {
+	if (setegid(process_privileged_gid) < 0) {
 		i_error("setegid(privileged) failed: %m");
 		return -1;
 	}
-	using_priv_gid = TRUE;
+	process_using_priv_gid = TRUE;
 	return 0;
 }
 
 void restrict_access_drop_priv_gid(void)
 {
-	if (!using_priv_gid)
+	if (!process_using_priv_gid)
 		return;
 
-	if (setegid(primary_gid) < 0)
+	if (setegid(process_primary_gid) < 0)
 		i_fatal("setegid(primary) failed: %m");
-	using_priv_gid = FALSE;
+	process_using_priv_gid = FALSE;
 }
 
 bool restrict_access_have_priv_gid(void)
 {
-	return privileged_gid != (gid_t)-1;
+	return process_privileged_gid != (gid_t)-1;
 }
--- a/src/master/dict-process.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/master/dict-process.c	Tue May 27 02:09:47 2008 +0300
@@ -25,7 +25,7 @@
 	struct io *io;
 };
 
-static struct dict_process *process;
+static struct dict_process *dict_process;
 
 static void dict_process_unlisten(struct dict_process *process);
 
@@ -181,7 +181,9 @@
 
 void dict_process_init(void)
 {
-	process = i_new(struct dict_process, 1);
+	struct dict_process *process;
+
+	process = dict_process = i_new(struct dict_process, 1);
 	process->process.type = PROCESS_TYPE_DICT;
 	process->fd = -1;
 	process->path = i_strconcat(settings_root->defaults->base_dir,
@@ -194,6 +196,8 @@
 
 void dict_process_deinit(void)
 {
+	struct dict_process *process = dict_process;
+
 	dict_process_unlisten(process);
 	if (process->log != NULL)
 		log_unref(process->log);
@@ -203,6 +207,8 @@
 
 void dict_process_kill(void)
 {
+	struct dict_process *process = dict_process;
+
 	if (process->log != NULL) {
 		log_unref(process->log);
 		process->log = NULL;
--- a/src/master/listener.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/master/listener.c	Tue May 27 02:09:47 2008 +0300
@@ -130,7 +130,7 @@
 }
 
 static void
-listener_init(const char *set_name, const char *listen,
+listener_init(const char *set_name, const char *listen_list,
 	      unsigned int default_port, ARRAY_TYPE(listener) *listens_arr)
 {
 	const char *const *tmp;
@@ -148,7 +148,7 @@
 	l.fd = -1;
 	l.wanted = TRUE;
 
-	for (tmp = t_strsplit_spaces(listen, ", "); *tmp != NULL; tmp++) {
+	for (tmp = t_strsplit_spaces(listen_list, ", "); *tmp != NULL; tmp++) {
 		l.port = default_port;
 		resolve_ip(set_name, *tmp, &l.ip, &l.port);
 
@@ -204,7 +204,7 @@
 {
 	const char *const *proto;
 	unsigned int default_port;
-	bool listen = FALSE, ssl_listen = FALSE;
+	bool nonssl_listen = FALSE, ssl_listen = FALSE;
 
 	if (set == NULL)
 		return;
@@ -214,14 +214,14 @@
 	for (; *proto != NULL; proto++) {
 		if (strcasecmp(*proto, "imap") == 0) {
 			if (set->protocol == MAIL_PROTOCOL_IMAP)
-				listen = TRUE;
+				nonssl_listen = TRUE;
 		} else if (strcasecmp(*proto, "imaps") == 0) {
 			if (set->protocol == MAIL_PROTOCOL_IMAP &&
 			    !set->ssl_disable)
 				ssl_listen = TRUE;
 		} else if (strcasecmp(*proto, "pop3") == 0) {
 			if (set->protocol == MAIL_PROTOCOL_POP3)
-				listen = TRUE;
+				nonssl_listen = TRUE;
 		} else if (strcasecmp(*proto, "pop3s") == 0) {
 			if (set->protocol == MAIL_PROTOCOL_POP3 &&
 			    !set->ssl_disable)
@@ -229,7 +229,7 @@
 		}
 	}
 
-	if (!listen)
+	if (!nonssl_listen)
 		listener_close_fds(&set->listens);
 	else {
 		default_port = set->protocol == MAIL_PROTOCOL_IMAP ? 143 : 110;
--- a/src/master/mail-process.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/master/mail-process.c	Tue May 27 02:09:47 2008 +0300
@@ -519,7 +519,7 @@
 
 enum master_login_status
 create_mail_process(enum process_type process_type, struct settings *set,
-		    int socket, const struct ip_addr *local_ip,
+		    int socket_fd, const struct ip_addr *local_ip,
 		    const struct ip_addr *remote_ip,
 		    const char *user, const char *const *args,
 		    bool dump_capability)
@@ -536,7 +536,7 @@
 	gid_t gid;
 	ARRAY_DEFINE(extra_args, const char *);
 	unsigned int i, len, count, left, process_count, throttle;
-	int ret, log_fd, nice, chdir_errno;
+	int ret, log_fd, nice_value, chdir_errno;
 	bool home_given, nfs_check;
 
 	i_assert(process_type == PROCESS_TYPE_IMAP ||
@@ -558,7 +558,7 @@
 
 	t_array_init(&extra_args, 16);
 	mail = home_dir = chroot_dir = system_user = "";
-	uid = (uid_t)-1; gid = (gid_t)-1; nice = 0;
+	uid = (uid_t)-1; gid = (gid_t)-1; nice_value = 0;
 	home_given = FALSE;
 	for (; *args != NULL; args++) {
 		if (strncmp(*args, "home=", 5) == 0) {
@@ -569,7 +569,7 @@
 		else if (strncmp(*args, "chroot=", 7) == 0)
 			chroot_dir = *args + 7;
 		else if (strncmp(*args, "nice=", 5) == 0)
-			nice = atoi(*args + 5);
+			nice_value = atoi(*args + 5);
 		else if (strncmp(*args, "system_user=", 12) == 0)
 			system_user = *args + 12;
 		else if (strncmp(*args, "uid=", 4) == 0) {
@@ -705,9 +705,9 @@
 	}
 
 #ifdef HAVE_SETPRIORITY
-	if (nice != 0) {
-		if (setpriority(PRIO_PROCESS, 0, nice) < 0)
-			i_error("setpriority(%d) failed: %m", nice);
+	if (nice_value != 0) {
+		if (setpriority(PRIO_PROCESS, 0, nice_value) < 0)
+			i_error("setpriority(%d) failed: %m", nice_value);
 	}
 #endif
 
@@ -720,9 +720,9 @@
 	child_process_init_env();
 
 	/* move the client socket into stdin and stdout fds, log to stderr */
-	if (dup2(dump_capability ? null_fd : socket, 0) < 0)
+	if (dup2(dump_capability ? null_fd : socket_fd, 0) < 0)
 		i_fatal("dup2(stdin) failed: %m");
-	if (dup2(socket, 1) < 0)
+	if (dup2(socket_fd, 1) < 0)
 		i_fatal("dup2(stdout) failed: %m");
 	if (dup2(log_fd, 2) < 0)
 		i_fatal("dup2(stderr) failed: %m");
--- a/src/master/mail-process.h	Tue May 27 00:16:12 2008 +0300
+++ b/src/master/mail-process.h	Tue May 27 02:09:47 2008 +0300
@@ -10,7 +10,7 @@
 
 enum master_login_status
 create_mail_process(enum process_type process_type, struct settings *set,
-		    int socket, const struct ip_addr *local_ip,
+		    int socket_fd, const struct ip_addr *local_ip,
 		    const struct ip_addr *remote_ip,
 		    const char *user, const char *const *args,
 		    bool dump_capability);
--- a/src/master/master-settings.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/master/master-settings.c	Tue May 27 02:09:47 2008 +0300
@@ -1650,7 +1650,7 @@
 {
 	const struct auth_passdb_settings *passdb;
 	const struct auth_userdb_settings *userdb;
-	const struct auth_socket_settings *socket;
+	const struct auth_socket_settings *socket_set;
 	const void *sets[2], *sets2[2];
 	const void *empty_defaults;
 
@@ -1682,23 +1682,23 @@
 				      nondefaults, 4);
 		}
 
-		socket = auth->sockets;
-		for (; socket != NULL; socket = socket->next) {
+		socket_set = auth->sockets;
+		for (; socket_set != NULL; socket_set = socket_set->next) {
 			printf("  socket:\n");
-			sets2[1] = socket;
+			sets2[1] = socket_set;
 			settings_dump(auth_socket_setting_defs, sets2, NULL, 2,
 				      nondefaults, 4);
 
-			if (socket->client.used) {
+			if (socket_set->client.used) {
 				printf("    client:\n");
-				sets2[1] = &socket->client;
+				sets2[1] = &socket_set->client;
 				settings_dump(socket_setting_defs, sets2, NULL,
 					      2, nondefaults, 6);
 			}
 
-			if (socket->master.used) {
+			if (socket_set->master.used) {
 				printf("    master:\n");
-				sets2[1] = &socket->master;
+				sets2[1] = &socket_set->master;
 				settings_dump(socket_setting_defs, sets2, NULL,
 					      2, nondefaults, 6);
 			}
--- a/src/plugins/fts-squat/squat-trie.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/plugins/fts-squat/squat-trie.c	Tue May 27 02:09:47 2008 +0300
@@ -643,17 +643,17 @@
 {
 	struct squat_node *child;
 	unsigned char *str;
-	unsigned int uid, idx, str_len = node->leaf_string_length;
+	unsigned int uid, idx, leafstr_len = node->leaf_string_length;
 
-	i_assert(str_len > 0);
+	i_assert(leafstr_len > 0);
 
 	/* make a copy of the leaf string and convert to normal node by
 	   removing it. */
-	str = t_malloc(str_len);
+	str = t_malloc(leafstr_len);
 	if (!NODE_IS_DYNAMIC_LEAF(node))
-		memcpy(str, node->children.static_leaf_string, str_len);
+		memcpy(str, node->children.static_leaf_string, leafstr_len);
 	else {
-		memcpy(str, node->children.leaf_string, str_len);
+		memcpy(str, node->children.leaf_string, leafstr_len);
 		i_free(node->children.leaf_string);
 	}
 	node->leaf_string_length = 0;
@@ -671,16 +671,17 @@
 	}
 
 	i_assert(!child->have_sequential && child->children.data == NULL);
-	if (str_len > 1) {
+	if (leafstr_len > 1) {
 		/* make the child a leaf string */
-		str_len--;
-		child->leaf_string_length = str_len;
+		leafstr_len--;
+		child->leaf_string_length = leafstr_len;
 		if (!NODE_IS_DYNAMIC_LEAF(child)) {
 			memcpy(child->children.static_leaf_string,
-			       str + 1, str_len);
+			       str + 1, leafstr_len);
 		} else {
-			child->children.leaf_string = i_malloc(str_len);
-			memcpy(child->children.leaf_string, str + 1, str_len);
+			child->children.leaf_string = i_malloc(leafstr_len);
+			memcpy(child->children.leaf_string,
+			       str + 1, leafstr_len);
 		}
 	}
 }
@@ -691,10 +692,10 @@
 			      const unsigned char *data, unsigned int data_len)
 {
 	const unsigned char *str = NODE_LEAF_STRING(node);
-	const unsigned int str_len = node->leaf_string_length;
+	const unsigned int leafstr_len = node->leaf_string_length;
 	unsigned int i;
 
-	if (data_len != str_len) {
+	if (data_len != leafstr_len) {
 		/* different lengths, can't match */
 		T_BEGIN {
 			node_split_string(ctx, node);
@@ -1757,15 +1758,15 @@
 				return -1;
 		}
 		if (node->leaf_string_length != 0) {
-			unsigned int str_len = node->leaf_string_length;
+			unsigned int len = node->leaf_string_length;
 			const unsigned char *str;
 
-			if (str_len > sizeof(node->children.static_leaf_string))
+			if (len > sizeof(node->children.static_leaf_string))
 				str = node->children.leaf_string;
 			else
 				str = node->children.static_leaf_string;
 
-			if (size > str_len || memcmp(data, str, size) != 0)
+			if (size > len || memcmp(data, str, size) != 0)
 				return 0;
 
 			/* match */
--- a/src/plugins/quota/quota-fs.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/plugins/quota/quota-fs.c	Tue May 27 02:09:47 2008 +0300
@@ -203,7 +203,7 @@
 	/* if there are more unused quota roots, copy this mount to them */
 	roots = array_get(&root->root.quota->roots, &count);
 	for (i = 0; i < count; i++) {
-		struct fs_quota_root *root = (struct fs_quota_root *)roots[i];
+		root = (struct fs_quota_root *)roots[i];
 		if (QUOTA_ROOT_MATCH(root, mount) && root->mount == NULL) {
 			mount->refcount++;
 			root->mount = mount;
--- a/src/util/idxview.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/util/idxview.c	Tue May 27 02:09:47 2008 +0300
@@ -21,12 +21,12 @@
 	uint32_t last_dirty_flush_stamp;
 };
 
-static const char *unixdate2str(time_t time)
+static const char *unixdate2str(time_t timestamp)
 {
 	static char buf[64];
 	struct tm *tm;
 
-	tm = localtime(&time);
+	tm = localtime(&timestamp);
 	strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", tm);
 	return buf;
 }
--- a/src/util/rawlog.c	Tue May 27 00:16:12 2008 +0300
+++ b/src/util/rawlog.c	Tue May 27 02:09:47 2008 +0300
@@ -274,15 +274,15 @@
 
 static void rawlog_open(enum rawlog_flags flags)
 {
-	const char *chroot, *home, *path;
+	const char *chroot_dir, *home, *path;
 	struct stat st;
 	int sfd[2];
 	pid_t pid;
 
-	chroot = getenv("RESTRICT_CHROOT");
+	chroot_dir = getenv("RESTRICT_CHROOT");
 	home = getenv("HOME");
-	if (chroot != NULL)
-		home = t_strconcat(chroot, home, NULL);
+	if (chroot_dir != NULL)
+		home = t_strconcat(chroot_dir, home, NULL);
 	else if (home == NULL)
 		home = ".";
 
@@ -296,9 +296,9 @@
 	if (!S_ISDIR(st.st_mode))
 		return;
 
-	if (chroot != NULL) {
+	if (chroot_dir != NULL) {
 		/* we'll chroot soon. skip over the chroot in the path. */
-		path += strlen(chroot);
+		path += strlen(chroot_dir);
 	}
 
 	if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0)