summaryrefslogtreecommitdiff
path: root/src/git/tree.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-11-05 03:20:17 +0200
committerVicent Marti <tanoku@gmail.com>2010-11-05 03:20:17 +0200
commit1795f87952a68155a618523799f70473483c7265 (patch)
tree239c2fef7674cc0407523be0a250b563361efc6b /src/git/tree.h
parent1714826fa08ad8612b720c8fdea636a4fc49c480 (diff)
downloadlibgit2-1795f87952a68155a618523799f70473483c7265.tar.gz
Improve error handling
All initialization functions now return error codes instead of pointers. Error codes are now properly propagated on most functions. Several new and more specific error codes have been added in common.h Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git/tree.h')
-rw-r--r--src/git/tree.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/git/tree.h b/src/git/tree.h
index 190fe95d6..f471113a8 100644
--- a/src/git/tree.h
+++ b/src/git/tree.h
@@ -26,11 +26,12 @@ typedef struct git_tree git_tree;
* The generated tree object is owned by the revision
* repo and shall not be freed by the user.
*
+ * @param tree pointer to the looked up tree
* @param repo the repo to use when locating the tree.
* @param id identity of the tree to locate.
- * @return the tree; NULL if the tree could not be created
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(git_tree *) git_tree_lookup(git_repository *repo, const git_oid *id);
+GIT_EXTERN(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git_oid *id);
/**
* Create a new in-memory git_tree.
@@ -39,10 +40,11 @@ GIT_EXTERN(git_tree *) git_tree_lookup(git_repository *repo, const git_oid *id);
* setter methods before it can be written to its
* repository.
*
+ * @param tree pointer to the new tree
* @param repo The repository where the object will reside
- * @return the object if creation was possible; NULL otherwise
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(git_tree *) git_tree_new(git_repository *repo);
+GIT_EXTERN(int) git_tree_new(git_tree **tree, git_repository *repo);
/**
* Get the id of a tree.
@@ -98,10 +100,12 @@ GIT_EXTERN(const git_oid *) git_tree_entry_id(git_tree_entry *entry);
/**
* Convert a tree entry to the git_object it points too.
+ *
+ * @param object pointer to the converted object
* @param entry a tree entry
* @return a reference to the pointed object in the repository
*/
-GIT_EXTERN(git_object *) git_tree_entry_2object(git_tree_entry *entry);
+GIT_EXTERN(int) git_tree_entry_2object(git_object **object, git_tree_entry *entry);
/**
* Add a new entry to a tree.