Closed namandixit closed 4 years ago
This makes sense to me, but I think the repeated stanza about #if !defined(LIBCO_...)
should go into settings.h
, where people who want to customise libco might look for settings.
Also, __VA_ARGS__
is apparently C99, while the rest of the codebase is (according to the README) C89. However, I don't know if that's a problem in practice. If you're working on embedded systems, you probably know more about the quirks of niche toolchains than I do.
Oh yeah, it should go into settings.h
. And you are right about __VA_ARGS__
too (we don't really need it, I guess I should stop being cheeky :)
Should be good to go now
That's a thumbs-up from me, but I'll wait a day or so to see if any other maintainers have any objections before hitting the button.
Is there anything blocking this PR?
Nah, not really.
This PR will make it possible for users to provide their own
malloc()
,free()
andassert()
wrappers. This means that using this library on Windows (if one plans on shipping without MSVCRT Redist) or on embedded platforms (without a libc) will be easier.The dependency on
mman.h
,windows.h
andunistd.h
are not touched, since I can't see why one might not want to use them on the relevant platforms.stdint.h
is also left in since it only provides type definitions and not any functions.The dependencies are still mandatory in the following files:
sjlj.c
:setjmp
/longjmp
are libc features anywayucontext.c
: No reason not to link to libc on POSIX systemsppc.c
: Still usesstring.h
formemcpy
. Sincememcpy
is usually a compiler intrinsic with some spec-mandated magical behaviour, not sure if it's technically safe to override it.