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

exercises: examples: improve ArrayList deinits #318

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Sep 12, 2023

There should be an errdefer after these initializations of an ArrayList - we subsequently use toOwnedSlice.

From the doc comment of toOwnedSlice:

/// The caller owns the returned memory. Empties this ArrayList,
/// Its capacity is cleared, making deinit() safe but unnecessary to call.
pub fn toOwnedSlice(self: *Self) Allocator.Error!Slice {

Refs: #313

@ee7 ee7 merged commit cea27d4 into exercism:main Sep 19, 2023
@ee7 ee7 deleted the exercises-examples-improve-deinits branch September 19, 2023 10:36
@ee7 ee7 changed the title exercises: examples: improve deinits exercises: examples: improve ArrayList deinits Sep 19, 2023
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.

2 participants