Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-13 00:46:44 +0400
committerRussell Belfer <rb@github.com>2013-06-13 00:46:44 +0400
commitef3374a8a81786a7b544ed7eded53c95766eb02f (patch)
tree66a813ad935656e145c583dea8b23c0ccb31c6ef /src/diff_patch.c
parentf9c824c592d7a23f7cc385c25c95a5d0c5c8687e (diff)
Improvements to git_array
This changes the size data to uint32_t, fixes the array growth logic to use a simple 1.5x multiplier, and uses a generic inline function for growing the array to make the git_array_alloc API feel more natural (i.e. it returns a pointer to the new item).
Diffstat (limited to 'src/diff_patch.c')
-rw-r--r--src/diff_patch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c
index 4c0b9a70c..05dee5ef7 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -712,7 +712,7 @@ static int diff_patch_hunk_cb(
GIT_UNUSED(delta);
- git_array_alloc(patch->hunks, hunk);
+ hunk = git_array_alloc(patch->hunks);
GITERR_CHECK_ALLOC(hunk);
memcpy(&hunk->range, range, sizeof(hunk->range));
@@ -749,7 +749,7 @@ static int diff_patch_line_cb(
hunk = git_array_last(patch->hunks);
GITERR_CHECK_ALLOC(hunk);
- git_array_alloc(patch->lines, line);
+ line = git_array_alloc(patch->lines);
GITERR_CHECK_ALLOC(line);
line->ptr = content;