vendor/libgit2/src/annotated_commit.c in rugged-1.1.1 vs vendor/libgit2/src/annotated_commit.c in rugged-1.2.0

- old
+ new

@@ -24,11 +24,12 @@ const char *description) { git_annotated_commit *annotated_commit; int error = 0; - assert(out && commit); + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(commit); *out = NULL; annotated_commit = git__calloc(1, sizeof(git_annotated_commit)); GIT_ERROR_CHECK_ALLOC(annotated_commit); @@ -61,11 +62,13 @@ const char *description) { 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; if ((error = git_commit_lookup(&commit, repo, id)) < 0) goto done; @@ -98,11 +101,13 @@ const char *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; if ((error = git_object_peel(&commit, obj, GIT_OBJECT_COMMIT))) { @@ -124,11 +129,13 @@ const git_reference *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; if ((error = git_reference_peel(&peeled, ref, GIT_OBJECT_COMMIT)) < 0) return error; @@ -152,15 +159,16 @@ git_repository *repo) { 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); git_reference_free(head); @@ -172,11 +180,15 @@ git_repository *repo, const char *branch_name, 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; (*out)->ref_name = git__strdup(branch_name); @@ -190,17 +202,17 @@ 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; } void git_annotated_commit_free(git_annotated_commit *annotated_commit) {