[PATCH 4/9] pv4_tree_desc: use struct tree_desc from pv4_tree_desc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 packv4-parse.c | 13 ++++++-------
 packv4-parse.h |  5 +++++
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/packv4-parse.c b/packv4-parse.c
index f9db364..f5c486e 100644
--- a/packv4-parse.c
+++ b/packv4-parse.c
@@ -10,7 +10,6 @@
 
 #include "cache.h"
 #include "packv4-parse.h"
-#include "tree-walk.h"
 #include "varint.h"
 
 const unsigned char *get_sha1ref(struct packed_git *p,
@@ -351,7 +350,7 @@ static int copy_canonical_tree_entries(struct pv4_tree_desc *v4, off_t offset,
 	const unsigned char *from, *end;
 	enum object_type type;
 	unsigned long size;
-	struct tree_desc desc;
+	struct tree_desc *desc = &v4->v2;
 
 	data = unpack_entry(v4->p, offset, &type, &size);
 	if (!data)
@@ -361,15 +360,15 @@ static int copy_canonical_tree_entries(struct pv4_tree_desc *v4, off_t offset,
 		return -1;
 	}
 
-	init_tree_desc(&desc, data, size);
+	init_tree_desc(desc, data, size);
 
 	while (start--)
-		update_tree_entry(&desc);
+		update_tree_entry(desc);
 
-	from = desc.buffer;
+	from = desc->buffer;
 	while (count--)
-		update_tree_entry(&desc);
-	end = desc.buffer;
+		update_tree_entry(desc);
+	end = desc->buffer;
 
 	if (end - from > strbuf_avail(&v4->buf)) {
 		free(data);
diff --git a/packv4-parse.h b/packv4-parse.h
index cad7a82..04b9a59 100644
--- a/packv4-parse.h
+++ b/packv4-parse.h
@@ -1,6 +1,8 @@
 #ifndef PACKV4_PARSE_H
 #define PACKV4_PARSE_H
 
+#include "tree-walk.h"
+
 struct packv4_dict {
 	const unsigned char *data;
 	unsigned int nb_entries;
@@ -27,6 +29,9 @@ struct pv4_tree_desc {
 	struct packed_git *p;
 	struct pack_window *w_curs;
 
+	/* v2 entry */
+	struct tree_desc v2;
+
 	/* full canonical tree */
 	struct strbuf buf;
 };
-- 
1.8.2.83.gc99314b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]