Commit efab78cd by Edward Thomson

blame: use GIT_ASSERT

parent b44b262b
......@@ -171,20 +171,21 @@ void git_blame_free(git_blame *blame)
uint32_t git_blame_get_hunk_count(git_blame *blame)
{
assert(blame);
GIT_ASSERT_ARG(blame);
return (uint32_t)blame->hunks.length;
}
const git_blame_hunk *git_blame_get_hunk_byindex(git_blame *blame, uint32_t index)
{
assert(blame);
GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
return (git_blame_hunk*)git_vector_get(&blame->hunks, index);
}
const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, size_t lineno)
{
size_t i, new_lineno = lineno;
assert(blame);
GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
return git_blame_get_hunk_byindex(blame, (uint32_t)i);
......@@ -388,7 +389,10 @@ int git_blame_file(
git_blame_options normOptions = GIT_BLAME_OPTIONS_INIT;
git_blame *blame = NULL;
assert(out && repo && path);
GIT_ASSERT_ARG(out);
GIT_ASSERT_ARG(repo);
GIT_ASSERT_ARG(path);
if ((error = normalize_options(&normOptions, options, repo)) < 0)
goto on_error;
......@@ -509,7 +513,9 @@ int git_blame_buffer(
diffopts.context_lines = 0;
assert(out && reference && buffer && buffer_len);
GIT_ASSERT_ARG(out);
GIT_ASSERT_ARG(reference);
GIT_ASSERT_ARG(buffer && buffer_len);
blame = git_blame__alloc(reference->repository, reference->options, reference->path);
GIT_ERROR_CHECK_ALLOC(blame);
......
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