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

Backport prevector fixes #923

Merged
merged 3 commits into from
Jul 30, 2016
Merged

Backport prevector fixes #923

merged 3 commits into from
Jul 30, 2016

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Jul 30, 2016

Merging fixes for prevector (this class is used in serialization) from bitcoin master branch.

Fixes a bug in which pop_back did not call the deleted item's destructor.

Using the most general erase() implementation to implement all the others
prevents similar bugs because the coupling between deallocation and destructor
invocation only needs to be maintained in one place.
Also reduces duplication of complex memmove logic.
swap was using an incorrect condition to determine when to apply an optimization
(not swapping the full direct[] when swapping two indirect prevectors).

Rather than correct the optimization I'm removing it for simplicity. Removing
this optimization minutely improves performance in the typical (currently only)
usage of member swap(), which is swapping with a freshly value-initialized
object.
- add a swap operation to prevector tests (fails due to broken prevector::swap)
- fix 2 prevector test operation conditions that were impossible
@UdjinM6 UdjinM6 added the bug label Jul 30, 2016
@schinzelh
Copy link

utACK

@schinzelh schinzelh merged commit 7551d2d into dashpay:v0.12.1.x Jul 30, 2016
@UdjinM6 UdjinM6 deleted the backportPrevectorFixes branch August 28, 2016 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants