Always start a sentence with lowercase letter after 'Note:', 'Warning:',
etc. This unifies all occurrences.
No functional change.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
The 'T' in the name notes that this API is a type-safe variant of the
API it wraps. This makes the names more explicative.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Compound literals are lvalues. This means it's possible to take their
address. That is, it would be possible (albeit nonsensical) to do
&strerrno();
It is also possible to assign to them (albeit also nonsensical):
strerrno() = NULL;
The statement expression performs lvalue conversion, which turns the
lvalue into an "rvalue", as expected, and disallows all those issues.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This name better reflects that it handles arrays, and doesn't shout.
This case is slightly different, as this macro does a little bit more
than just enforcing arrays. It changes the return value too. However,
that is related-enough to the handling of arrays that I'm inclined to
accept it as a minor inconsistency.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
"config.h" is a locally generated header. It must be included as
'#include "config.h"'.
It is already included correctly in some sources files. This commit
unifies the way how "config.h" is included.
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
This API set implements another usual loop around strsep(3).
This one implements a loop where we are interested in an arbitrary
number of fields. For that, a NULL terminator is added at the end.
That is commonly referred to as "list".
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This API set implements the usual loop around strsep(3).
This one implements a loop where we are interested in an exact number of
fields. I'll add another API set, strsep2ls() and STRSEP2LS(), which
will add a NULL terminator, for arbitrary numbers of fields.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
These functions are just like [v]asprintf(3), but simpler.
They return the newly allocated memory, which allows us to use the
[[gnu::malloc(free)]] attribute, which enhances static analysis.
They also omit the length, which we don't care about at all.
As a curiosity, Plan9 seems to provide this same API, under the name
smprint(3).
Link: <https://9fans.github.io/plan9port/man/man3/print.html>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This provides a safer and more consistent API.
We had the strrspn(3) function as it was for compatibility with Oracle
Solaris, but let's not repeat their mistake. Nevertheless, name our
function strrspn_() with a trailing underscore, to differentiate it from
the one in Solaris, since it's slightly different.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
These APIs are to strrspn(), like strcspn() is to strspn().
They are like strcspn(3), but search from the end of the string.
The function is meant for internal use, and consistency with libc.
The macro is meant for normal use, since it returns a pointer,
which is what algorithms using this need.
See also strspn(3) and strcspn(3).
Signed-off-by: Alejandro Colomar <alx@kernel.org>