Skip to content

Commit

Permalink
Make Repostirory_as_iter shorter
Browse files Browse the repository at this point in the history
Error_set already returns NULL
  • Loading branch information
jdavid committed Jan 5, 2013
1 parent 48b906c commit 9ec56c0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/pygit2/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,17 @@ Repository_as_iter(Repository *self)
PyObject *accum = PyList_New(0);

err = git_repository_odb(&odb, self->repo);
if (err < 0) {
Error_set(err);
return NULL;
}
if (err < 0)
return Error_set(err);

err = git_odb_foreach(odb, Repository_build_as_iter, (void*)accum);
git_odb_free(odb);
if (err == GIT_EUSER) {
git_odb_free(odb);
return NULL;
} else if (err < 0) {
git_odb_free(odb);
Error_set(err);
return NULL;
return Error_set(err);
}

git_odb_free(odb);
return PyObject_GetIter(accum);
}

Expand Down

0 comments on commit 9ec56c0

Please sign in to comment.