Commit f10d7a36 by Russell Belfer

Further callback error check style fixes

Okay, I've decided I like the readability of this style much
better so I used it everywhere.
parent c7b3e1b3
......@@ -507,9 +507,10 @@ int git_config_backend_foreach_match(
continue;
/* abort iterator on non-zero return value */
error = GITERR_CALLBACK( cb(entry, payload) );
if (error)
if ((error = cb(entry, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
if (regexp != NULL)
......@@ -533,9 +534,12 @@ int git_config_foreach_match(
if ((error = git_config_iterator_glob_new(&iter, cfg, regexp)) < 0)
return error;
while (!(error = git_config_next(&entry, iter)) &&
!(error = GITERR_CALLBACK( cb(entry, payload) )))
/* make callback on each config */;
while (!(error = git_config_next(&entry, iter))) {
if ((error = cb(entry, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
git_config_iterator_free(iter);
......@@ -794,8 +798,10 @@ int git_config_get_multivar_foreach(
while ((err = iter->next(&entry, iter)) == 0) {
found = 1;
if ((err = GITERR_CALLBACK( cb(entry, payload) )) != 0)
if ((err = cb(entry, payload)) != 0) {
GITERR_CALLBACK(err);
break;
}
}
iter->free(iter);
......
......@@ -582,10 +582,12 @@ int git_note_foreach(
if ((error = git_note_iterator_new(&iter, repo, notes_ref)) < 0)
return error;
while (!(error = git_note_next(&note_id, &annotated_id, iter)) &&
!(error = GITERR_CALLBACK(
note_cb(&note_id, &annotated_id, payload))))
/* callback for each note */;
while (!(error = git_note_next(&note_id, &annotated_id, iter))) {
if ((error = note_cb(&note_id, &annotated_id, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
if (error == GIT_ITEROVER)
error = 0;
......
......@@ -516,9 +516,12 @@ int git_reference_foreach(
if ((error = git_reference_iterator_new(&iter, repo)) < 0)
return error;
while (!(error = git_reference_next(&ref, iter)) &&
!(error = GITERR_CALLBACK( callback(ref, payload) )))
/* callback on each reference */;
while (!(error = git_reference_next(&ref, iter))) {
if ((error = callback(ref, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
if (error == GIT_ITEROVER)
error = 0;
......@@ -539,9 +542,12 @@ int git_reference_foreach_name(
if ((error = git_reference_iterator_new(&iter, repo)) < 0)
return error;
while (!(error = git_reference_next_name(&refname, iter)) &&
!(error = GITERR_CALLBACK( callback(refname, payload) )))
/* callback on each reference name */;
while (!(error = git_reference_next_name(&refname, iter))) {
if ((error = callback(refname, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
if (error == GIT_ITEROVER)
error = 0;
......@@ -563,9 +569,12 @@ int git_reference_foreach_glob(
if ((error = git_reference_iterator_glob_new(&iter, repo, glob)) < 0)
return error;
while (!(error = git_reference_next_name(&refname, iter)) &&
!(error = GITERR_CALLBACK( callback(refname, payload) )))
/* callback on each matching reference name */;
while (!(error = git_reference_next_name(&refname, iter))) {
if ((error = callback(refname, payload)) != 0) {
GITERR_CALLBACK(error);
break;
}
}
if (error == GIT_ITEROVER)
error = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment