Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix excessive realloc in DArray_pop #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix excessive realloc in DArray_pop #14

wants to merge 2 commits into from

Conversation

abbioro
Copy link

@abbioro abbioro commented Jul 10, 2016

Was reallocing on every pop except the one where it was supposed to realloc, basically every pop when the max was greater than the expand rate. I also changed the 1st condition when popping so that it correctly resizes to 301 now that it reallocs correctly.

I also added a couple checks to the tests so that after every push and pop it makes sure that max is a multiple of expand_rate + 1 (as long as we're just pushing/popping elements it should resize in increments of the expand_rate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant