Hi Simon,

> Would adding mem_startswith (arbitrary char* buffers) and/or
> c_startswith (arbitrary NUL-terminated 7-bit strings) make sense?

c_startswith and str_startswith are the same.

mem_startswith and mem_endswith would make sense, if some package needs them.
We already have them in the form of the functions sd_startswith and sd_endswith
for string_desc_t strings.
For mere memory buffers, it remains to be seen how much of a simplification
such functions would be.
I don't see much of a potential for these functions to reduce mistakes; recall
that the mistake that I mentioned for str_endswith was due to an incorrect
inlining of a strlen() call, whereas for mem_* function there is no strlen()
call.

> Unless I'm missing something, the comparison idiom is useful for memory
> buffers too, where you don't want locale to influence behaviour.

If one of your packages needs this, we can add it. Both the naming of the
functions and implementation would be straightforward.

Bruno




Reply via email to