diff options
-rw-r--r-- | builtin/merge-tree.c | 2 | ||||
-rw-r--r-- | tree-walk.h | 5 | ||||
-rw-r--r-- | unpack-trees.c | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index f0e4cfefaa..0629c87b19 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -180,7 +180,7 @@ static struct merge_list *create_entry(unsigned stage, unsigned mode, const stru static char *traverse_path(const struct traverse_info *info, const struct name_entry *n) { - char *path = xmallocz(traverse_path_len(info, n)); + char *path = xmallocz(traverse_path_len(info, tree_entry_len(n))); return make_traverse_path(path, info, n->path, n->pathlen); } diff --git a/tree-walk.h b/tree-walk.h index 47bf85d282..a25c751c1e 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -74,9 +74,10 @@ char *make_traverse_path(char *path, const struct traverse_info *info, const char *name, size_t namelen); void setup_traverse_info(struct traverse_info *info, const char *base); -static inline size_t traverse_path_len(const struct traverse_info *info, const struct name_entry *n) +static inline size_t traverse_path_len(const struct traverse_info *info, + size_t namelen) { - return st_add(info->pathlen, tree_entry_len(n)); + return st_add(info->pathlen, namelen); } /* in general, positive means "kind of interesting" */ diff --git a/unpack-trees.c b/unpack-trees.c index 8dbfb22770..492eff666a 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -686,7 +686,7 @@ static int index_pos_by_traverse_info(struct name_entry *names, struct traverse_info *info) { struct unpack_trees_options *o = info->data; - size_t len = traverse_path_len(info, names); + size_t len = traverse_path_len(info, tree_entry_len(names)); char *name = xmalloc(len + 1 /* slash */ + 1 /* NUL */); int pos; @@ -936,7 +936,7 @@ static int compare_entry(const struct cache_entry *ce, const struct traverse_inf * Even if the beginning compared identically, the ce should * compare as bigger than a directory leading up to it! */ - return ce_namelen(ce) > traverse_path_len(info, n); + return ce_namelen(ce) > traverse_path_len(info, tree_entry_len(n)); } static int ce_in_traverse_path(const struct cache_entry *ce, @@ -960,7 +960,7 @@ static struct cache_entry *create_ce_entry(const struct traverse_info *info, struct index_state *istate, int is_transient) { - size_t len = traverse_path_len(info, n); + size_t len = traverse_path_len(info, tree_entry_len(n)); struct cache_entry *ce = is_transient ? make_empty_transient_cache_entry(len) : |