From b0b8313583afdcd54a83ba3855cf3f6f287ae0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 22 Mar 2011 16:15:50 +0100 Subject: Add close wappers for commit, tree, tag and blob MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/git2/tree.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/git2/tree.h') diff --git a/include/git2/tree.h b/include/git2/tree.h index ec2b51646..cb959a790 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -52,6 +52,24 @@ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git return git_object_lookup((git_object **)tree, repo, id, GIT_OBJ_TREE); } +/** + * 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. * -- cgit v1.2.1