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

remove strndupa to build on musl #139

Closed
wants to merge 1 commit into from
Closed

Conversation

mischief
Copy link

@mischief mischief commented Jan 4, 2025

musl lacks strndupa, and we have attribute cleanup macros, so use them instead.

musl lacks strndupa, and we have attribute cleanup macros, so use them
instead.
@keszybz
Copy link
Member

keszybz commented Jan 19, 2025

I don't think this makes sense. strndupa is a simple function that is used everywhere. So it's approximately a thousand times easier to just implement it once in the c library than to modify every project that uses it. Just fix musl.

The problem with this patch is that strdup can fail. Which means that some error handling needs to be added. And with the error handling, the code is much more verbose and complicated.

@keszybz keszybz closed this Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants