summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-12-09 09:44:03 -0800
committerRussell Belfer <rb@github.com>2013-12-11 10:57:50 -0800
commit26c1cb91beccb44425864bd233ed0e35f5801868 (patch)
tree378f665d0adebca36a14a590f2103f2e5cd6c9ac /src/tree.c
parentf10d7a368fa4af28b1e6f082349ffa4f62b3c00e (diff)
downloadlibgit2-26c1cb91beccb44425864bd233ed0e35f5801868.tar.gz
One more rename/cleanup for callback err functions
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tree.c b/src/tree.c
index 5f35ac3a8..4d77ff778 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -883,9 +883,12 @@ static int tree_walk(
git_vector_foreach(&tree->entries, i, entry) {
if (preorder) {
- if ((error = callback(path->ptr, entry, payload)) < 0)
- return giterr_set_callback(error, "git_tree_walk");
- if (error > 0) {
+ error = callback(path->ptr, entry, payload);
+ if (error < 0) { /* negative value stops iteration */
+ giterr_set_after_callback_function(error, "git_tree_walk");
+ break;
+ }
+ if (error > 0) { /* positive value skips this entry */
error = 0;
continue;
}
@@ -916,8 +919,11 @@ static int tree_walk(
}
if (!preorder) {
- if ((error = callback(path->ptr, entry, payload)) < 0)
- return giterr_set_callback(error, "git_tree_walk");
+ error = callback(path->ptr, entry, payload);
+ if (error < 0) { /* negative value stops iteration */
+ giterr_set_after_callback_function(error, "git_tree_walk");
+ break;
+ }
error = 0;
}
}