path: root/tree-walk.h
diff options
authorJeff King <>2019-07-31 04:38:23 (GMT)
committerJunio C Hamano <>2019-08-01 20:06:52 (GMT)
commitc43ab062598d0299ea6e0d115a6018189a7793bf (patch)
tree03abcb873feb9ab6d23d51f9e7f45d1c2b14af26 /tree-walk.h
parentb3b3cbcbf246b1051ad453bc02e24a89573e2911 (diff)
tree-walk: add a strbuf wrapper for make_traverse_path()
All but one of the callers of make_traverse_path() allocate a new heap buffer to store the path. Let's give them an easy way to write to a strbuf, which saves them from computing the length themselves (which is especially tricky when they want to add to the path). It will also make it easier for us to change the make_traverse_path() interface in a future patch to improve its bounds-checking. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'tree-walk.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/tree-walk.h b/tree-walk.h
index a25c751..994c14a 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -72,6 +72,9 @@ struct traverse_info {
int get_tree_entry(const struct object_id *, const char *, struct object_id *, unsigned short *);
char *make_traverse_path(char *path, const struct traverse_info *info,
const char *name, size_t namelen);
+void strbuf_make_traverse_path(struct strbuf *out,
+ 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,