summaryrefslogtreecommitdiff
path: root/merge-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 /merge-tree.c
parent171dccd511bb4642e4491dc5115549b67a859a5b (diff)
downloadgit-a8c40471ab0851bf9a58f7dc76f121258e0690e2.tar.gz
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 'merge-tree.c')
-rw-r--r--merge-tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/merge-tree.c b/merge-tree.c
index b2867ba722..3b8d9e6887 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -188,7 +188,7 @@ static void resolve(const char *base, struct name_entry *branch1, struct name_en
static int unresolved_directory(const char *base, struct name_entry n[3])
{
- int baselen;
+ int baselen, pathlen;
char *newbase;
struct name_entry *p;
struct tree_desc t[3];
@@ -205,10 +205,11 @@ static int unresolved_directory(const char *base, struct name_entry n[3])
if (!S_ISDIR(p->mode))
return 0;
baselen = strlen(base);
- newbase = xmalloc(baselen + p->pathlen + 2);
+ pathlen = tree_entry_len(p->path, p->sha1);
+ newbase = xmalloc(baselen + pathlen + 2);
memcpy(newbase, base, baselen);
- memcpy(newbase + baselen, p->path, p->pathlen);
- memcpy(newbase + baselen + p->pathlen, "/", 2);
+ memcpy(newbase + baselen, p->path, pathlen);
+ memcpy(newbase + baselen + pathlen, "/", 2);
buf0 = fill_tree_descriptor(t+0, n[0].sha1);
buf1 = fill_tree_descriptor(t+1, n[1].sha1);