Hi Alejandro,
> Similar to strnul(3) returning a pointer, this stpspn(3) is a macro that
> returns a pointer instead of a length.
Oh wait. Should we have called the new function stpnul() instead of strnul()?
Because it returns a pointer.
> The canonical implementation I have in shadow-utils is
>
> #define stpspn(s, accept) \
> ({ \
> __auto_type s_ = s; \
> \
> s_ + strspn(s_, accept); \
> })
>
> but for gnulib I've implemented it similar to strnul(3). This macro
> covers most uses of strspn(3)
I agree that this macro is a nice-to-have, alongside with stpcspn().
Previously one would have defined it as a function with return type 'char *',
but that would have been ugly. With a const-generic macro, it's nicer.
> In replies to this cover letter, you'll find a patch that implements
> stpspn(), and another patch that uses it in gnulib, to show how
> beneficial it is.
Please, let's finalize the strnul patches first. Not too many patch sets
in parallel at the same time...
Bruno