12 Commits

Author SHA1 Message Date
Alejandro Colomar
0afe216953 lib/: Rename MALLOC() => malloc_T()
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>
2025-12-05 21:22:45 -06:00
Alejandro Colomar
af3f3202d0 */: s/STRSEP2ARR/strsep2arr_a/
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>
2025-11-27 20:50:48 -06:00
Alejandro Colomar
a2207ea60a */: s/STRSEP2LS/strsep2ls_a/
This name better reflects that it handles arrays, and doesn't shout.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-27 20:50:48 -06:00
Alejandro Colomar
655ffcbe1b lib/, src/, tests/: Move x*() definitions to non-x* header files
Now that all of these are one-liners, they don't need a separate header
file.  Compact stuff.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-10-27 14:32:06 +01:00
Alejandro Colomar
e5b6968406 lib/string/strtok/: xastrsep2ls() Reimplement in terms of exit_if_null()
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-10-27 14:32:06 +01:00
Evgeny Grin (Karlson2k)
eb71706b1c */: Fix including <config.h> as system header
"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>
2025-07-16 14:12:40 +02:00
Alejandro Colomar
422a5e9975 lib/string/strtok/: xastrsep2ls(): Add function
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-06-07 16:52:03 +02:00
Alejandro Colomar
e168508b00 lib/string/strtok/: astrsep2ls(): Add function
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-06-07 16:52:03 +02:00
Alejandro Colomar
2af9f9d012 lib/string/strtok/: strsep2ls(), STRSEP2LS(): Add APIs
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>
2025-06-07 16:52:03 +02:00
Alejandro Colomar
4e64ef6993 lib/string/strtok/: strsep2arr(), STRSEP2ARR(): Add APIs
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>
2025-06-07 16:52:03 +02:00
Alejandro Colomar
3cba5e2e1c lib/string/: Add comments expanding the letter-soup API names
Suggested-by: Serge Hallyn <serge@hallyn.com>
Cc: Chris Bazley <Chris.Bazley@arm.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-02-16 13:22:51 -06:00
Alejandro Colomar
39da15614e lib/string/strtok/stpsep.[ch]: stpsep(): Add function
This function is somewhat simpler to use than strsep(3) in some cases.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-07-08 20:25:01 -05:00