tree.c: update read_tree_recursive callback to pass strbuf as base
This allows the callback to use 'base' as a temporary buffer to quickly assemble full path "without" extra allocation. The callback has to restore it afterwards of course. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b260d265e1
commit
6a0b0b6de9
3
tree.h
3
tree.h
@ -4,6 +4,7 @@
|
||||
#include "object.h"
|
||||
|
||||
extern const char *tree_type;
|
||||
struct strbuf;
|
||||
|
||||
struct tree {
|
||||
struct object object;
|
||||
@ -22,7 +23,7 @@ void free_tree_buffer(struct tree *tree);
|
||||
struct tree *parse_tree_indirect(const unsigned char *sha1);
|
||||
|
||||
#define READ_TREE_RECURSIVE 1
|
||||
typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int, void *);
|
||||
typedef int (*read_tree_fn_t)(const unsigned char *, struct strbuf *, const char *, unsigned int, int, void *);
|
||||
|
||||
extern int read_tree_recursive(struct tree *tree,
|
||||
const char *base, int baselen,
|
||||
|
Reference in New Issue
Block a user