mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 16:34:33 +00:00
Merge pull request #2487 from libgit2/cmn/revwalk-no-prealloc
Work around strict aliasing in array growth
This commit is contained in:
commit
59e3f45b61
@ -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 */
|
/* 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_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;
|
uint32_t new_size = (a->size < 8) ? 8 : a->asize * 3 / 2;
|
||||||
char *new_array = git__realloc(a->ptr, new_size * item_size);
|
char *new_array = git__realloc(a->ptr, new_size * item_size);
|
||||||
if (!new_array) {
|
if (!new_array) {
|
||||||
|
@ -48,9 +48,6 @@ static int mark_uninteresting(git_revwalk *walk, git_commit_list_node *commit)
|
|||||||
|
|
||||||
assert(commit);
|
assert(commit);
|
||||||
|
|
||||||
git_array_init_to_size(pending, 2);
|
|
||||||
GITERR_CHECK_ARRAY(pending);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
commit->uninteresting = 1;
|
commit->uninteresting = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user