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

- old
+ new

@@ -93,11 +93,11 @@ git_patch *patch, git_diff_format_t format, git_diff_line_cb cb, void *payload) { - assert(patch); + GIT_ASSERT_ARG(patch); memset(pi, 0, sizeof(diff_print_info)); pi->flags = patch->diff_opts.flags; pi->id_strlen = patch->diff_opts.id_abbrev; @@ -762,12 +762,18 @@ } /* print a git_diff to a git_buf */ int git_diff_to_buf(git_buf *out, git_diff *diff, git_diff_format_t format) { - assert(out && diff); - git_buf_sanitize(out); + int error; + + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(diff); + + if ((error = git_buf_sanitize(out)) < 0) + return error; + return git_diff_print(diff, format, git_diff_print_callback__to_buf, out); } /* print a git_patch to an output callback */ int git_patch_print( @@ -777,11 +783,12 @@ { git_buf temp = GIT_BUF_INIT; diff_print_info pi; int error; - assert(patch && print_cb); + GIT_ASSERT_ARG(patch); + GIT_ASSERT_ARG(print_cb); if ((error = diff_print_info_init_frompatch(&pi, &temp, patch, GIT_DIFF_FORMAT_PATCH, print_cb, payload)) < 0) goto out; @@ -797,9 +804,15 @@ } /* print a git_patch to a git_buf */ int git_patch_to_buf(git_buf *out, git_patch *patch) { - assert(out && patch); - git_buf_sanitize(out); + int error; + + GIT_ASSERT_ARG(out); + GIT_ASSERT_ARG(patch); + + if ((error = git_buf_sanitize(out)) < 0) + return error; + return git_patch_print(patch, git_diff_print_callback__to_buf, out); }