summaryrefslogtreecommitdiff
path: root/tree-walk.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-03-21 17:08:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-03-21 17:21:57 (GMT)
commit6fda5e5180c2e7c130978361aea53b4e66f36823 (patch)
tree89df3a31883fe84ae06d1c05f29fa823614eef87 /tree-walk.h
parenta8c40471ab0851bf9a58f7dc76f121258e0690e2 (diff)
downloadgit-6fda5e5180c2e7c130978361aea53b4e66f36823.zip
git-6fda5e5180c2e7c130978361aea53b4e66f36823.tar.gz
git-6fda5e5180c2e7c130978361aea53b4e66f36823.tar.bz2
Initialize tree descriptors with a helper function rather than by hand.
This removes slightly more lines than it adds, but the real reason for doing this is that future optimizations will require more setup of the tree descriptor, and so we want to do it in one place. Also renamed the "desc.buf" field to "desc.buffer" just to trigger compiler errors for old-style manual initializations, making sure I didn't miss anything. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tree-walk.h')
-rw-r--r--tree-walk.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/tree-walk.h b/tree-walk.h
index 149393a..ca0c29f 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -2,8 +2,8 @@
#define TREE_WALK_H
struct tree_desc {
- const void *buf;
- unsigned long size;
+ const void *buffer;
+ unsigned int size;
};
struct name_entry {
@@ -18,6 +18,7 @@ static inline int tree_entry_len(const char *name, const unsigned char *sha1)
}
void update_tree_entry(struct tree_desc *);
+void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size);
const unsigned char *tree_entry_extract(struct tree_desc *, const char **, unsigned int *);
/* Helper function that does both of the above and returns true for success */