Carlo Bramini - 2014-01-12

Perhaps the strnlen() function and its variants could be implemented directly with less efforts, by using already existing functions, for example like this:

~~~~static inline
size_t strnlen( const char start, size_t maxlen )
{
const char
end = (const char *)memchr(start, '\0', maxlen);

return (end) ? (size_t)(end - start) : maxlen;

}
~~~~