summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-08-27 10:36:17 +0200
committerPatrick Steinhardt <ps@pks.im>2020-03-26 16:20:17 +0100
commit35168571973d25882837a1c841c689b79a012b23 (patch)
tree1561e9713e6b0d3c3b8539d7be3402f4a4af5b51
parentf647d0218a32d2a65dd097aadb7ac669c2f6ad46 (diff)
downloadlibgit2-35168571973d25882837a1c841c689b79a012b23.tar.gz
iterator: remove duplicate memset
When allocating new tree iterator frames, we zero out the allocated memory twice. Remove one of the `memset` calls.
-rw-r--r--src/iterator.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/iterator.c b/src/iterator.c
index c6a8fd452..f8b3a008f 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -543,8 +543,6 @@ static int tree_iterator_frame_init(
new_frame = git_array_alloc(iter->frames);
GIT_ERROR_CHECK_ALLOC(new_frame);
- memset(new_frame, 0, sizeof(tree_iterator_frame));
-
if ((error = git_tree_dup(&dup, tree)) < 0)
goto done;
@@ -552,14 +550,14 @@ static int tree_iterator_frame_init(
new_frame->tree = dup;
if (frame_entry &&
- (error = tree_iterator_compute_path(&new_frame->path, frame_entry)) < 0)
+ (error = tree_iterator_compute_path(&new_frame->path, frame_entry)) < 0)
goto done;
cmp = iterator__ignore_case(&iter->base) ?
tree_iterator_entry_sort_icase : NULL;
- if ((error = git_vector_init(
- &new_frame->entries, dup->entries.size, cmp)) < 0)
+ if ((error = git_vector_init(&new_frame->entries,
+ dup->entries.size, cmp)) < 0)
goto done;
git_array_foreach(dup->entries, i, tree_entry) {