From: David Herrmann Date: Tue, 17 Mar 2015 11:20:31 +0000 (+0100) Subject: strv: return NULL from strv_free() X-Git-Tag: v219.0~268 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=33c2ce7b200747c172d4899c717a8e9097d84659 strv: return NULL from strv_free() We always return NULL/invalid-object from destructors, fix strv_free() to do the same. --- diff --git a/src/shared/strv.c b/src/shared/strv.c index ee45ad1d0..8c6ba6a63 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -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) { diff --git a/src/shared/strv.h b/src/shared/strv.h index 518c4c2aa..a80ccd642 100644 --- a/src/shared/strv.h +++ b/src/shared/strv.h @@ -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)