chiark / gitweb /
strv: return NULL from strv_free()
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 17 Mar 2015 11:20:31 +0000 (12:20 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 19 Mar 2015 13:12:00 +0000 (14:12 +0100)
We always return NULL/invalid-object from destructors, fix strv_free() to
do the same.

src/shared/strv.c
src/shared/strv.h

index ee45ad1d0f3bb434044462696f675432e28c3ed4..8c6ba6a6336c1e252218c1c8b6109b81e77e37a1 100644 (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) {
index 518c4c2aa8b94da5d013a97127ef3d27595a8e43..a80ccd6427cf6bf697188f4fc50d3d94f4409300 100644 (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)