diff options
author | Junio C Hamano <junkio@cox.net> | 2007-04-03 02:06:59 +0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-04 11:19:28 +0400 |
commit | 9a4d8fdc25d6ba08564766c6ded165212f423b61 (patch) | |
tree | 34b5061bdbc8002f500e0af8effd3ca5e662fb70 | |
parent | 7f7932ab25f2ddd6080c8b1e8bfd698e523eb7d4 (diff) |
unpack-trees: get rid of *indpos parameter.
This variable keeps track of which entry in the original index
the traversal is looking at, and belongs to the unpack_trees_options
structure along with other traversal status information.
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r-- | unpack-trees.c | 16 | ||||
-rw-r--r-- | unpack-trees.h | 1 |
2 files changed, 8 insertions, 9 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 9c0f4d7651..4cf83bd90a 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -70,7 +70,6 @@ static int entcmp(const char *name1, int dir1, const char *name2, int dir2) static int unpack_trees_rec(struct tree_entry_list **posns, int len, const char *base, struct unpack_trees_options *o, - int *indpos, struct tree_entry_list *df_conflict_list) { int baselen = strlen(base); @@ -100,7 +99,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, cache_name = NULL; /* Check the cache */ - if (o->merge && *indpos < active_nr) { + if (o->merge && o->pos < active_nr) { /* This is a bit tricky: */ /* If the index has a subdirectory (with * contents) as the first name, it'll get a @@ -118,7 +117,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, * file case. */ - cache_name = active_cache[*indpos]->name; + cache_name = active_cache[o->pos]->name; if (strlen(cache_name) > baselen && !memcmp(cache_name, base, baselen)) { cache_name += baselen; @@ -158,8 +157,8 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, if (cache_name && !strcmp(cache_name, first)) { any_files = 1; - src[0] = active_cache[*indpos]; - remove_cache_entry_at(*indpos); + src[0] = active_cache[o->pos]; + remove_cache_entry_at(o->pos); } for (i = 0; i < len; i++) { @@ -228,7 +227,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, #if DBRT_DEBUG > 1 printf("Added %d entries\n", ret); #endif - *indpos += ret; + o->pos += ret; } else { for (i = 0; i < src_size; i++) { if (src[i]) { @@ -244,7 +243,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, newbase[baselen + pathlen] = '/'; newbase[baselen + pathlen + 1] = '\0'; if (unpack_trees_rec(subposns, len, newbase, o, - indpos, df_conflict_list)) { + df_conflict_list)) { retval = -1; goto leave_directory; } @@ -375,7 +374,6 @@ static void check_updates(struct cache_entry **src, int nr, int unpack_trees(struct object_list *trees, struct unpack_trees_options *o) { - int indpos = 0; unsigned len = object_list_length(trees); struct tree_entry_list **posns; int i; @@ -404,7 +402,7 @@ int unpack_trees(struct object_list *trees, struct unpack_trees_options *o) posn = posn->next; } if (unpack_trees_rec(posns, len, o->prefix ? o->prefix : "", - o, &indpos, &df_conflict_list)) + o, &df_conflict_list)) return -1; } diff --git a/unpack-trees.h b/unpack-trees.h index 191f7442f1..fee7da4382 100644 --- a/unpack-trees.h +++ b/unpack-trees.h @@ -16,6 +16,7 @@ struct unpack_trees_options { int verbose_update; int aggressive; const char *prefix; + int pos; struct dir_struct *dir; merge_fn_t fn; |