]> git.ipfire.org Git - thirdparty/git.git/blobdiff - tree-walk.h
tree-walk.c: do not leak internal structure in tree_entry_len()
[thirdparty/git.git] / tree-walk.h
index 0089581e1dd55800302799a7381d4a7ad01bd79d..884d01ac3371024c567ef9f8d96d714fe3a34cd3 100644 (file)
@@ -20,9 +20,9 @@ static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, co
        return desc->entry.sha1;
 }
 
-static inline int tree_entry_len(const char *name, const unsigned char *sha1)
+static inline int tree_entry_len(const struct name_entry *ne)
 {
-       return (const char *)sha1 - name - 1;
+       return (const char *)ne->sha1 - ne->path - 1;
 }
 
 void update_tree_entry(struct tree_desc *);
@@ -58,7 +58,7 @@ extern void setup_traverse_info(struct traverse_info *info, const char *base);
 
 static inline int traverse_path_len(const struct traverse_info *info, const struct name_entry *n)
 {
-       return info->pathlen + tree_entry_len(n->path, n->sha1);
+       return info->pathlen + tree_entry_len(n);
 }
 
 extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, int, const struct pathspec *ps);