Skip to content

feat: Add C strdup() #112

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

Merged
merged 6 commits into from
May 20, 2025
Merged

feat: Add C strdup() #112

merged 6 commits into from
May 20, 2025

Conversation

graebm
Copy link
Collaborator

@graebm graebm commented May 1, 2025

Also, make allocation failures fatal (see conversion here). region_alloc(), region_strdup(), and region_strndup() will all abort the program if memory allocation fails. But I added a new region_try_alloc() function, that may still return NULL, if we find we want to try and handle Out of Memory in specific circumstances where we might actually expect it (e.g. allocating an arbitrarily sized buffer)

Also: make allocation failures fatal (see conversion [here](leanprover#99 (comment))). Now alloc(), strdup(), and strndup() will all abort if memory allocation fails. But add new try_alloc() function that may still return NULL, if we find we want to try and handle Out of Memory in specific circumstances where we might actually expect it (e.g. allocating an arbitrarily sized buffer)
@graebm graebm merged commit fcf748a into leanprover:main May 20, 2025
@graebm graebm deleted the graebm/strdup branch May 20, 2025 16:46
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