Skip to content

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

2 participants