From 671f0707212c929533dc6ec9e032faee328e4602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 14 Jul 2008 21:22:12 +0200 Subject: add context pointer to read_tree_recursive() Add a pointer parameter to read_tree_recursive(), which is passed to the callback function. This allows callers of read_tree_recursive() to share data with the callback without resorting to global variables. All current callers pass NULL. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- archive-tar.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'archive-tar.c') diff --git a/archive-tar.c b/archive-tar.c index 99db58f1c..6eaf59eb0 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -234,9 +234,9 @@ static int git_tar_config(const char *var, const char *value, void *cb) return git_default_config(var, value, cb); } -static int write_tar_entry(const unsigned char *sha1, - const char *base, int baselen, - const char *filename, unsigned mode, int stage) +static int write_tar_entry(const unsigned char *sha1, const char *base, + int baselen, const char *filename, unsigned mode, int stage, + void *context) { static struct strbuf path = STRBUF_INIT; void *buffer; @@ -286,11 +286,12 @@ int write_tar_archive(struct archiver_args *args) while (baselen > 0 && base[baselen - 1] == '/') base[--baselen] = '\0'; - write_tar_entry(args->tree->object.sha1, "", 0, base, 040777, 0); + write_tar_entry(args->tree->object.sha1, "", 0, base, 040777, + 0, NULL); free(base); } read_tree_recursive(args->tree, args->base, plen, 0, - args->pathspec, write_tar_entry); + args->pathspec, write_tar_entry, NULL); write_trailer(); return 0; -- cgit v1.2.1