Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Explorer09
Copy link
Contributor

This is a follow-up of commit 08166b2

This frees up the need of dirty_index and dirty_count members of Vector object. These two members are not supposed to last long and are only useful in keeping the state between the softRemove() and compact() operations.

Rework the two operations so that the caller would keep the dirtyIndex when calling softRemove() and pass dirtyIndex to the compact() in the final step.

The new dirtyIndex is safe to migrate to using size_t as I don't use any negative value of it.

Use a goto label when a table row should be removed.
No changes to code behavior.
Remove the 'dirty_index' and 'dirty_count' members of Vector object.
Let the caller of the Vector_softRemove() operation track the
'dirtyIndex' and pass it to Vector_compact() when needed.
'dirtyIndex' is supposed to have shorter lifespan than a Vector
instance, and by removing the member we can save object size.

'dirty_count' is redundant and thus removed as well.
A boolean 'isDirty' member is added to a Vector object for ease of
debugging.

Signed-off-by: Kang-Che Sung <[email protected]>
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