diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-04-04 23:31:05 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-11-25 11:42:03 +0000 |
commit | f60ebfcb6b66b317ced1acca463e729cc182b83d (patch) | |
tree | 61893c058f4ac526a41b9e8a25baaa7daeccfc1d /src/annotated_commit.c | |
parent | b8cdc9c9c59c61fc699550af5245c57744c1bcbd (diff) | |
download | libgit2-f60ebfcb6b66b317ced1acca463e729cc182b83d.tar.gz |
annotated_commit: use GIT_ASSERT
Diffstat (limited to 'src/annotated_commit.c')
-rw-r--r-- | src/annotated_commit.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/annotated_commit.c b/src/annotated_commit.c index 5d4f37082..e48947679 100644 --- a/src/annotated_commit.c +++ b/src/annotated_commit.c @@ -26,7 +26,8 @@ static int annotated_commit_init( git_annotated_commit *annotated_commit; int error = 0; - assert(out && commit); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(commit); *out = NULL; @@ -63,7 +64,9 @@ static int annotated_commit_init_from_id( git_commit *commit = NULL; int error = 0; - assert(out && repo && id); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(repo); + GIT_ASSERT_ARG(id); *out = NULL; @@ -100,7 +103,9 @@ int git_annotated_commit_from_revspec( git_object *obj, *commit; int error; - assert(out && repo && revspec); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(repo); + GIT_ASSERT_ARG(revspec); if ((error = git_revparse_single(&obj, repo, revspec)) < 0) return error; @@ -126,7 +131,9 @@ int git_annotated_commit_from_ref( git_object *peeled; int error = 0; - assert(out && repo && ref); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(repo); + GIT_ASSERT_ARG(ref); *out = NULL; @@ -154,11 +161,12 @@ int git_annotated_commit_from_head( git_reference *head; int error; - assert(out && repo); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(repo); *out = NULL; - if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0) + if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0) return -1; error = git_annotated_commit_from_ref(out, repo, head); @@ -174,7 +182,11 @@ int git_annotated_commit_from_fetchhead( const char *remote_url, const git_oid *id) { - assert(repo && id && branch_name && remote_url); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(repo); + GIT_ASSERT_ARG(branch_name); + GIT_ASSERT_ARG(remote_url); + GIT_ASSERT_ARG(id); if (annotated_commit_init_from_id(out, repo, id, branch_name) < 0) return -1; @@ -192,14 +204,14 @@ int git_annotated_commit_from_fetchhead( const git_oid *git_annotated_commit_id( const git_annotated_commit *annotated_commit) { - assert(annotated_commit); + GIT_ASSERT_ARG_WITH_RETVAL(annotated_commit, NULL); return git_commit_id(annotated_commit->commit); } const char *git_annotated_commit_ref( const git_annotated_commit *annotated_commit) { - assert(annotated_commit); + GIT_ASSERT_ARG_WITH_RETVAL(annotated_commit, NULL); return annotated_commit->ref_name; } |