aboutsummaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-03-21 10:07:46 -0700
committerJunio C Hamano <junkio@cox.net>2007-03-21 10:21:56 -0700
commita8c40471ab0851bf9a58f7dc76f121258e0690e2 (patch)
tree161da4c14a0d4f45cff256ca0df7789a81545e59 /tree.c
parent171dccd511bb4642e4491dc5115549b67a859a5b (diff)
downloadgit-a8c40471ab0851bf9a58f7dc76f121258e0690e2.tar.gz
git-a8c40471ab0851bf9a58f7dc76f121258e0690e2.tar.xz
Remove "pathlen" from "struct name_entry"
Since we have the "tree_entry_len()" helper function these days, and don't need to do a full strlen(), there's no point in saving the path length - it's just redundant information. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index 24f8fb676..705a48125 100644
--- a/tree.c
+++ b/tree.c
@@ -101,14 +101,15 @@ int read_tree_recursive(struct tree *tree,
if (S_ISDIR(entry.mode)) {
int retval;
char *newbase;
+ unsigned int pathlen = tree_entry_len(entry.path, entry.sha1);
- newbase = xmalloc(baselen + 1 + entry.pathlen);
+ newbase = xmalloc(baselen + 1 + pathlen);
memcpy(newbase, base, baselen);
- memcpy(newbase + baselen, entry.path, entry.pathlen);
- newbase[baselen + entry.pathlen] = '/';
+ memcpy(newbase + baselen, entry.path, pathlen);
+ newbase[baselen + pathlen] = '/';
retval = read_tree_recursive(lookup_tree(entry.sha1),
newbase,
- baselen + entry.pathlen + 1,
+ baselen + pathlen + 1,
stage, match, fn);
free(newbase);
if (retval)