summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-01-22 09:35:25 -0800
committerVicent Marti <vicent@github.com>2014-01-22 09:35:25 -0800
commitec088fec9dc65621275b9f16d746820af67592de (patch)
tree548900c29909e116ec5c3c1fe41370bef3460ac5 /src
parentaf2b969b6f63dafa8c55b88cadbcc7631c2dd30b (diff)
parentc05cd7924d2409741bb4cb1eb3ba843bea7ec4a2 (diff)
downloadlibgit2-ec088fec9dc65621275b9f16d746820af67592de.tar.gz
Merge pull request #2069 from isilkor/patch_to_buf
Expose patch serialization to git_buf
Diffstat (limited to 'src')
-rw-r--r--src/diff_print.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/diff_print.c b/src/diff_print.c
index 7a70e2b18..dd31d1ffa 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -452,20 +452,10 @@ static int diff_print_to_buffer_cb(
return git_buf_put(output, line->content, line->content_len);
}
-/* print a git_patch to a string buffer */
-int git_patch_to_str(
- char **string,
+/* print a git_patch to a git_buf */
+int git_patch_to_buf(
+ git_buf *out,
git_patch *patch)
{
- int error;
- git_buf output = GIT_BUF_INIT;
-
- if (!(error = git_patch_print(patch, diff_print_to_buffer_cb, &output)))
- *string = git_buf_detach(&output);
- else {
- git_buf_free(&output);
- *string = NULL;
- }
-
- return error;
+ return git_patch_print(patch, diff_print_to_buffer_cb, out);
}