Hi Alejandro,
1) The name 'strnul' is good: unambiguous, descriptive (it returns a pointer
to the NUL byte), without artificial truncations, and consistent with
other functions such as strchrnul().
2) What I like about it is that it makes code more consistent:
Some people preferred to write it like this:
> - end_name = strchr (unescape, '\0');
> + end_name = strnul (unescape);
and other people like this:
> - sentinel = hwcaps + strlen (hwcaps);
> + sentinel = strnul (hwcaps);
3) What I don't like about your patch are those parts where the code
becomes harder to validate, such as
> bool output_is_library =
> (strlen (output_file) >= 4
> - && memeq (output_file + strlen (output_file) - 4, ".dll", 4));
> + && memeq (strnul (output_file) - 4, ".dll", 4));
because
* The check strlen (output_file) >= 4 made it immediately clear that
output_file + strlen (output_file) - 4
is not out-of-range. Whereas when you write
strnul (output_file) - 4
it requires some amount of thought to realize that the result is
not out-of-range.
* The purpose of this code is NOT to get a pointer to the NUL byte.
It is to get a pointer to the last substring of length 4 of the string.
Bruno