mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 10:28:56 +00:00
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>
This commit is contained in:
parent
7c80c19e1d
commit
b0b8313583
@ -52,6 +52,24 @@ GIT_INLINE(int) git_blob_lookup(git_blob **blob, git_repository *repo, const git
|
||||
return git_object_lookup((git_object **)blob, repo, id, GIT_OBJ_BLOB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open blob
|
||||
*
|
||||
* This is a wrapper around git_object_close()
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop
|
||||
* using a blob. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param blob the blob to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_blob_close(git_blob *blob)
|
||||
{
|
||||
return git_object_close((git_object *) blob);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a read-only buffer with the raw content of a blob.
|
||||
*
|
||||
|
@ -53,6 +53,23 @@ GIT_INLINE(int) git_commit_lookup(git_commit **commit, git_repository *repo, con
|
||||
return git_object_lookup((git_object **)commit, repo, id, GIT_OBJ_COMMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open commit
|
||||
*
|
||||
* This is a wrapper around git_object_close()
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop
|
||||
* using a commit. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param commit the commit to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_commit_close(git_commit *commit)
|
||||
{
|
||||
return git_object_close((git_object *) commit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of a commit.
|
||||
*
|
||||
|
@ -52,6 +52,24 @@ GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oi
|
||||
return git_object_lookup((git_object **)tag, repo, id, (git_otype)GIT_OBJ_TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open tag
|
||||
*
|
||||
* This is a wrapper around git_object_close()
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop
|
||||
* using a tag. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param tag the tag to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_tag_close(git_tag *tag)
|
||||
{
|
||||
return git_object_close((git_object *) tag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the id of a tag.
|
||||
*
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user