I don't use Zepher. I assume most people here do, and assume that this isn't an issue for many.
With a lot of setups, POSIX_SOURCE is set to zero. Which means that in <string.h>, strnlen() will not be included. Obviously this is an issue if using zcbor from https://github.com/NordicSemiconductor/zcbor/pull/342 on.
I would probably make a note in the readme that you may need either
#define POSIX_C_SOURCE 200809L
Or if using CMake, -D_POSIX_C_SOURCE=200809L
Both of these assuming GCC (I'm using ARM-NONE-EABI v12.3 toolchain).
There are also portable versions of strnlen() like this but that may be more annoying to work in compared to being included in <string.h>
If it were me, I probably would have included that simple portable version as WEAK or optional in case the user didn't define or want POSIX above.
I don't use Zepher. I assume most people here do, and assume that this isn't an issue for many.
With a lot of setups, POSIX_SOURCE is set to zero. Which means that in
<string.h>
,strnlen()
will not be included. Obviously this is an issue if using zcbor from https://github.com/NordicSemiconductor/zcbor/pull/342 on.I would probably make a note in the readme that you may need either
#define POSIX_C_SOURCE 200809L
Or if using CMake,
-D_POSIX_C_SOURCE=200809L
Both of these assuming GCC (I'm using ARM-NONE-EABI v12.3 toolchain).
There are also portable versions of strnlen() like this but that may be more annoying to work in compared to being included in
<string.h>
If it were me, I probably would have included that simple portable version as WEAK or optional in case the user didn't define or want POSIX above.