summaryrefslogtreecommitdiff
path: root/tests/diff/diffiter.c
diff options
context:
space:
mode:
authorNicolas Hake <nh@nosebud.de>2014-01-22 17:51:32 +0100
committerNicolas Hake <nh@nosebud.de>2014-01-22 17:51:32 +0100
commitc05cd7924d2409741bb4cb1eb3ba843bea7ec4a2 (patch)
tree548900c29909e116ec5c3c1fe41370bef3460ac5 /tests/diff/diffiter.c
parent450e8e9e623b8c172ba4628c146838cbf4c56519 (diff)
downloadlibgit2-c05cd7924d2409741bb4cb1eb3ba843bea7ec4a2.tar.gz
Drop git_patch_to_str
It's hard or even impossible to correctly free the string buffer allocated by git_patch_to_str in some circumstances. Drop the function so people have to use git_patch_to_buf instead - git_buf has a dedicated destructor.
Diffstat (limited to 'tests/diff/diffiter.c')
-rw-r--r--tests/diff/diffiter.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/diff/diffiter.c b/tests/diff/diffiter.c
index f886e1baa..c976e30e2 100644
--- a/tests/diff/diffiter.c
+++ b/tests/diff/diffiter.c
@@ -414,16 +414,16 @@ void test_diff_diffiter__iterate_and_generate_patch_text(void)
for (d = 0; d < num_d; ++d) {
git_patch *patch;
- char *text;
+ git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_patch_from_diff(&patch, diff, d));
cl_assert(patch != NULL);
- cl_git_pass(git_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_to_buf(&buf, patch));
- cl_assert_equal_s(expected_patch_text[d], text);
+ cl_assert_equal_s(expected_patch_text[d], buf.ptr);
- git__free(text);
+ git_buf_free(&buf);
git_patch_free(patch);
}