From c05cd7924d2409741bb4cb1eb3ba843bea7ec4a2 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Wed, 22 Jan 2014 17:51:32 +0100 Subject: 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. --- tests/diff/diffiter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/diff/diffiter.c') 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); } -- cgit v1.2.1