mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-07 06:03:51 +00:00
shared: strv - add strv_clear()
This frees the elements of the strv without freeing the strv itself.
This commit is contained in:
+6
-1
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user