strv: get rid of strv_clear()
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Jan 2020 09:07:34 +0000 (10:07 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Jan 2020 09:07:34 +0000 (10:07 +0100)
commit2e5180d38b33710506ab76dcf93f802864b9ec0f
treed246a21a2b8b2b7119843b732b880973722844ca
parentcdc6804b6046282a42117678751c126a022cd24a
strv: get rid of strv_clear()

Let's remove a function of questionnable utility.

strv_clear() frees the items of a string array, but not the array
itself. i.e. it half-drestructs a string array and makes it empty. This
is not too useful an operation since we almost never need to just do
that, we also want to free the whole thing. In fact, strv_clear() is
only used in one of our .c file, and there it appears like unnecessary
optimization, given that for each array with n elements it leaves the
number of free()s we need to at O(n) which is not really an optimization
at all (it goes from n+1 to n, that's all).

Prompted by the discussions on #14605
src/basic/strv.c
src/basic/strv.h
src/libsystemd/sd-hwdb/hwdb-util.c