summaryrefslogtreecommitdiffstats
path: root/src/basic/nulstr-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* nulstr-util: minor cleanupMike Yuan2024-03-211-24/+23
|
* nulstr-util: make ret_size in strv_make_nulstr() optionalYu Watanabe2023-05-081-3/+2
|
* nulstr-util: introduce strv_parse_nulstr_full() that optionally drop ↵Yu Watanabe2023-03-241-1/+5
| | | | trailing empty strings
* set: add set_make_nulstrQuentin Deslandes2022-12-151-0/+15
| | | | | Add function set_make_nulstr() to create a nulstr out of a set. Behave the same way as strv_make_nulstr().
* nulstr-util: fix corner cases of strv_make_nulstr()Lennart Poettering2022-11-131-8/+14
| | | | | | | | | | | | | | | | | | | | | | Let's change the return semantics of strv_make_nulstr() so that we can properly distuingish the case where we have a no entries in the nulstr from the case where we have a single empty string in a nulstr. Previously we couldn't distuingish those, we'd in both cases return a size of zero, and a buffer with two NUL bytes. With this change, we'll still return a buffer with two NULL bytes, but for the case where no entries are defined we'll return a size of zero, and where we have two a size of one. This is a good idea, as it makes sure we can properly handle all corner cases. Nowadays the function is used by one place only: ask-password-api.c. The corner case never mattered there, since it was used to serialize passwords, and it was known that there was exactly one password, not less. But let's clean this up. This means the subtraction of the final NUL byte now happens in ask-password-api.c instead.
* nulstr-util: don't use 'r' for anything but integer return valuesLennart Poettering2022-11-131-6/+8
|
* nulstr-util: use memdup_suffix0() where appropriateLennart Poettering2022-11-131-1/+1
| | | | | | if the nulstr is not nul-terminated, we shouldn't use strndup() but memdup_suffix0(), to not trip up static analyzers which imply we are duping a string here.
* nulstr-util: use _cleanup_strv_free_() where appropriateLennart Poettering2022-11-131-10/+6
|
* nulstr-util: rebreak commentsLennart Poettering2022-11-131-15/+10
|
* strv: move nulstr utilities to nulstr-util.[ch]Lennart Poettering2022-11-131-0/+113
| | | | | | | Let's move them out of the generic, already very long strv.[ch] module into the more specific nulst-util.[ch] No code changes.
* nulstr-util: Declare NULSTR_FOREACH() iterator inlineDaan De Meyer2022-11-111-2/+0
|
* basic: nulstr-util: add nulstr_get() returning the matching stringArnaud Ferraris2021-09-151-4/+4
| | | | | | | | | | | | Currently `nulstr_contains` returns a boolean, making it difficult to identify which of the input strings matches the "needle". Adding a new `nulstr_get()` function, returning a const pointer to the matching string, eases this process and allows us to directly re-use the result of a call to this function without additional processing or memory allocation. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* util: split out nulstr related stuff to nulstr-util.[ch]Lennart Poettering2019-03-141-0/+17