summaryrefslogtreecommitdiff
path: root/include/git2/tree.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-03-22 16:15:50 +0100
committerCarlos Martín Nieto <cmn@elego.de>2011-03-23 11:08:42 +0100
commitb0b8313583afdcd54a83ba3855cf3f6f287ae0ab (patch)
tree7afe2242087618b4d1ae15d42b7c52b7bf79a824 /include/git2/tree.h
parent7c80c19e1dffb4421f91913bc79b9cb7596634a4 (diff)
downloadlibgit2-b0b8313583afdcd54a83ba3855cf3f6f287ae0ab.tar.gz
Add close wappers for commit, tree, tag and blob
In the same spirit that git_repository_lookup is no longer available, add wrappers so the users don't have to cast when closing their objects. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'include/git2/tree.h')
-rw-r--r--include/git2/tree.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/git2/tree.h b/include/git2/tree.h
index ec2b5164..cb959a79 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -53,6 +53,24 @@ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git
}
/**
+ * Close an open tree
+ *
+ * This is a wrapper around git_object_close()
+ *
+ * IMPORTANT:
+ * It *is* necessary to call this method when you stop
+ * using a tree. Failure to do so will cause a memory leak.
+ *
+ * @param tree the tree to close
+ */
+
+GIT_INLINE(void) git_tree_close(git_tree *tree)
+{
+ return git_object_close((git_object *) tree);
+}
+
+
+/**
* Get the id of a tree.
*
* @param tree a previously loaded tree.