mirror of
https://github.com/systemd/systemd.git
synced 2025-03-08 08:58:27 +03:00
shared: strv - add strv_clear()
This frees the elements of the strv without freeing the strv itself.
This commit is contained in:
parent
3542eac7f9
commit
dd9c7723fa
@ -69,7 +69,7 @@ char *strv_find_startswith(char **l, const char *name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void strv_free(char **l) {
|
||||
void strv_clear(char **l) {
|
||||
char **k;
|
||||
|
||||
if (!l)
|
||||
@ -78,6 +78,11 @@ void strv_free(char **l) {
|
||||
for (k = l; *k; k++)
|
||||
free(*k);
|
||||
|
||||
*l = NULL;
|
||||
}
|
||||
|
||||
void strv_free(char **l) {
|
||||
strv_clear(l);
|
||||
free(l);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ void strv_free(char **l);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
|
||||
#define _cleanup_strv_free_ _cleanup_(strv_freep)
|
||||
|
||||
void strv_clear(char **l);
|
||||
|
||||
char **strv_copy(char * const *l);
|
||||
unsigned strv_length(char * const *l) _pure_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user