diff options
author | Vicent Marti <vicent@github.com> | 2014-07-25 13:27:51 +0400 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-07-25 13:27:51 +0400 |
commit | 59e3f45b6150984e6a74ce79062caa459eda369f (patch) | |
tree | 431e3c8db1bf31788e22f3a50497b32f5a64e233 | |
parent | 9de6ec52008e3f30a4e8a5c6a13859eefcf86f57 (diff) | |
parent | b62a6a13b2f9a40e6ea4bf7bc2a9255429fb0bd6 (diff) |
Merge pull request #2487 from libgit2/cmn/revwalk-no-prealloc
Work around strict aliasing in array growth
-rw-r--r-- | src/array.h | 2 | ||||
-rw-r--r-- | src/revwalk.c | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/src/array.h b/src/array.h index f8a48722a..af9eafa43 100644 --- a/src/array.h +++ b/src/array.h @@ -44,7 +44,7 @@ typedef git_array_t(char) git_array_generic_t; /* use a generic array for growth so this can return the new item */ GIT_INLINE(void *) git_array_grow(void *_a, size_t item_size) { - git_array_generic_t *a = _a; + volatile git_array_generic_t *a = _a; uint32_t new_size = (a->size < 8) ? 8 : a->asize * 3 / 2; char *new_array = git__realloc(a->ptr, new_size * item_size); if (!new_array) { diff --git a/src/revwalk.c b/src/revwalk.c index 530c9705e..bd07d02cb 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -48,9 +48,6 @@ static int mark_uninteresting(git_revwalk *walk, git_commit_list_node *commit) assert(commit); - git_array_init_to_size(pending, 2); - GITERR_CHECK_ARRAY(pending); - do { commit->uninteresting = 1; |