strv: return NULL from strv_free()

We always return NULL/invalid-object from destructors, fix strv_free() to
do the same.
This commit is contained in:
David Herrmann 2015-03-17 12:20:31 +01:00
parent e0d065d405
commit 33c2ce7b20
2 changed files with 3 additions and 2 deletions

View file

@ -80,9 +80,10 @@ void strv_clear(char **l) {
*l = NULL;
}
void strv_free(char **l) {
char **strv_free(char **l) {
strv_clear(l);
free(l);
return NULL;
}
char **strv_copy(char * const *l) {

View file

@ -31,7 +31,7 @@ char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;
char *strv_find_startswith(char **l, const char *name) _pure_;
void strv_free(char **l);
char **strv_free(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
#define _cleanup_strv_free_ _cleanup_(strv_freep)