dovecot: s/field/field_idx/

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 14 04:40:38 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/5763c2548153
changeset: 5735:5763c2548153
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 14 04:05:13 2007 +0300
description:
s/field/field_idx/

diffstat:

3 files changed, 35 insertions(+), 35 deletions(-)
src/lib-index/mail-cache-lookup.c      |   22 ++++++++++----------
src/lib-index/mail-cache-transaction.c |   34 ++++++++++++++++----------------
src/lib-index/mail-cache.h             |   14 ++++++-------

diffs (189 lines):

diff -r 5f0832288007 -r 5763c2548153 src/lib-index/mail-cache-lookup.c
--- a/src/lib-index/mail-cache-lookup.c	Thu Jun 14 03:20:18 2007 +0300
+++ b/src/lib-index/mail-cache-lookup.c	Thu Jun 14 04:05:13 2007 +0300
@@ -282,11 +282,11 @@ int mail_cache_field_exists(struct mail_
 }
 
 enum mail_cache_decision_type
-mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field)
-{
-	i_assert(field < cache->fields_count);
-
-	return cache->fields[field].field.decision;
+mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx)
+{
+	i_assert(field_idx < cache->fields_count);
+
+	return cache->fields[field_idx].field.decision;
 }
 
 struct mail_cache_lookup_context {
@@ -334,21 +334,21 @@ mail_cache_lookup_bitmask_callback(struc
 }
 
 int mail_cache_lookup_field(struct mail_cache_view *view, buffer_t *dest_buf,
-			    uint32_t seq, unsigned int field)
+			    uint32_t seq, unsigned int field_idx)
 {
 	struct mail_cache_lookup_context ctx;
 	const struct mail_cache_field *field_def;
 	int ret;
 
-	if ((ret = mail_cache_field_exists(view, seq, field)) <= 0)
+	if ((ret = mail_cache_field_exists(view, seq, field_idx)) <= 0)
 		return ret;
-	field_def = &view->cache->fields[field].field;
-
-	mail_cache_decision_state_update(view, seq, field);
+	field_def = &view->cache->fields[field_idx].field;
+
+	mail_cache_decision_state_update(view, seq, field_idx);
 
 	/* the field should exist */
 	memset(&ctx, 0, sizeof(ctx));
-	ctx.field = field;
+	ctx.field = field_idx;
 	ctx.dest_buf = dest_buf;
 
 	if (field_def->type != MAIL_CACHE_FIELD_BITMASK) {
diff -r 5f0832288007 -r 5763c2548153 src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Thu Jun 14 03:20:18 2007 +0300
+++ b/src/lib-index/mail-cache-transaction.c	Thu Jun 14 04:05:13 2007 +0300
@@ -660,7 +660,7 @@ void mail_cache_transaction_rollback(str
 }
 
 static int mail_cache_header_add_field(struct mail_cache_transaction_ctx *ctx,
-				       unsigned int field)
+				       unsigned int field_idx)
 {
 	struct mail_cache *cache = ctx->cache;
 	buffer_t *buffer;
@@ -678,7 +678,7 @@ static int mail_cache_header_add_field(s
 		return -1;
 	}
 
-	if (ctx->cache->field_file_map[field] != (uint32_t)-1) {
+	if (ctx->cache->field_file_map[field_idx] != (uint32_t)-1) {
 		/* it was already added */
 		if (mail_cache_unlock(cache) < 0)
 			return -1;
@@ -726,32 +726,32 @@ static int mail_cache_header_add_field(s
 }
 
 void mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq,
-		    unsigned int field, const void *data, size_t data_size)
+		    unsigned int field_idx, const void *data, size_t data_size)
 {
 	uint32_t file_field, data_size32;
 	unsigned int fixed_size;
 	size_t full_size;
 
-	i_assert(field < ctx->cache->fields_count);
+	i_assert(field_idx < ctx->cache->fields_count);
 	i_assert(data_size < (uint32_t)-1);
 
-	if (ctx->cache->fields[field].field.decision ==
+	if (ctx->cache->fields[field_idx].field.decision ==
 	    (MAIL_CACHE_DECISION_NO | MAIL_CACHE_DECISION_FORCED))
 		return;
 
-	file_field = ctx->cache->field_file_map[field];
+	file_field = ctx->cache->field_file_map[field_idx];
 	if (file_field == (uint32_t)-1) {
 		/* we'll have to add this field to headers */
-		if (mail_cache_header_add_field(ctx, field) < 0)
+		if (mail_cache_header_add_field(ctx, field_idx) < 0)
 			return;
 
-		file_field = ctx->cache->field_file_map[field];
+		file_field = ctx->cache->field_file_map[field_idx];
 		i_assert(file_field != (uint32_t)-1);
 	}
 
-	mail_cache_decision_add(ctx->view, seq, field);
-
-	fixed_size = ctx->cache->fields[field].field.field_size;
+	mail_cache_decision_add(ctx->view, seq, field_idx);
+
+	fixed_size = ctx->cache->fields[field_idx].field.field_size;
 	i_assert(fixed_size == (unsigned int)-1 || fixed_size == data_size);
 
 	data_size32 = (uint32_t)data_size;
@@ -799,27 +799,27 @@ void mail_cache_add(struct mail_cache_tr
 }
 
 bool mail_cache_field_want_add(struct mail_cache_transaction_ctx *ctx,
-			       uint32_t seq, unsigned int field)
+			       uint32_t seq, unsigned int field_idx)
 {
 	enum mail_cache_decision_type decision;
 
-	decision = mail_cache_field_get_decision(ctx->view->cache, field);
+	decision = mail_cache_field_get_decision(ctx->view->cache, field_idx);
 	if ((decision & ~MAIL_CACHE_DECISION_FORCED) == MAIL_CACHE_DECISION_NO)
 		return FALSE;
 
-	return mail_cache_field_exists(ctx->view, seq, field) == 0;
+	return mail_cache_field_exists(ctx->view, seq, field_idx) == 0;
 }
 
 bool mail_cache_field_can_add(struct mail_cache_transaction_ctx *ctx,
-			      uint32_t seq, unsigned int field)
+			      uint32_t seq, unsigned int field_idx)
 {
 	enum mail_cache_decision_type decision;
 
-	decision = mail_cache_field_get_decision(ctx->view->cache, field);
+	decision = mail_cache_field_get_decision(ctx->view->cache, field_idx);
 	if (decision == (MAIL_CACHE_DECISION_FORCED | MAIL_CACHE_DECISION_NO))
 		return FALSE;
 
-	return mail_cache_field_exists(ctx->view, seq, field) == 0;
+	return mail_cache_field_exists(ctx->view, seq, field_idx) == 0;
 }
 
 static int mail_cache_link_unlocked(struct mail_cache *cache,
diff -r 5f0832288007 -r 5763c2548153 src/lib-index/mail-cache.h
--- a/src/lib-index/mail-cache.h	Thu Jun 14 03:20:18 2007 +0300
+++ b/src/lib-index/mail-cache.h	Thu Jun 14 04:05:13 2007 +0300
@@ -74,33 +74,33 @@ mail_cache_get_transaction(struct mail_c
 /* Add new field to given record. Updates are not allowed. Fixed size fields
    must be exactly the expected size. */
 void mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq,
-		    unsigned int field, const void *data, size_t data_size);
+		    unsigned int field_idx, const void *data, size_t data_size);
 /* Returns TRUE if field is wanted to be added and it doesn't already exist.
    If current caching decisions say not to cache this field, FALSE is returned.
    If seq is 0, the existence isn't checked. */
 bool mail_cache_field_want_add(struct mail_cache_transaction_ctx *ctx,
-			       uint32_t seq, unsigned int field);
+			       uint32_t seq, unsigned int field_idx);
 /* Like mail_cache_field_want_add(), but in caching decisions FALSE is
    returned only if the decision is a forced no. */
 bool mail_cache_field_can_add(struct mail_cache_transaction_ctx *ctx,
-			      uint32_t seq, unsigned int field);
+			      uint32_t seq, unsigned int field_idx);
 
 /* Retursn 1 if field exists, 0 if not, -1 if error. */
 int mail_cache_field_exists(struct mail_cache_view *view, uint32_t seq,
-			    unsigned int field);
+			    unsigned int field_idx);
 /* Returns current caching decision for given field. */
 enum mail_cache_decision_type
-mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field);
+mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx);
 
 /* Set data_r and size_r to point to wanted field in cache file.
    Returns 1 if field was found, 0 if not, -1 if error. */
 int mail_cache_lookup_field(struct mail_cache_view *view, buffer_t *dest_buf,
-			    uint32_t seq, unsigned int field);
+			    uint32_t seq, unsigned int field_idx);
 
 /* Return specified cached headers. Returns 1 if all fields were found,
    0 if not, -1 if error. dest is updated only if all fields were found. */
 int mail_cache_lookup_headers(struct mail_cache_view *view, string_t *dest,
-			      uint32_t seq, unsigned int fields[],
+			      uint32_t seq, unsigned int field_idxs[],
 			      unsigned int fields_count);
 
 /* "Error in index cache file %s: ...". */


More information about the dovecot-cvs mailing list