On Mon, Aug 03, 2020 at 12:25:31AM +0200, Ján Tomko wrote:
The g_strdupv function from GLib provides the same functionality. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/util/virstring.c | 37 ------------------------------------- src/util/virstring.h | 3 --- 2 files changed, 40 deletions(-)
Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
diff --git a/src/util/virstring.c b/src/util/virstring.c index 2d7ddc4676..9da811b2ec 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -259,43 +259,6 @@ virStringListMerge(char ***dst, } -/** - * virStringListCopy: - * @dst: where to store the copy of @strings - * @src: a NULL-terminated array of strings - * - * Makes a deep copy of the @src string list and stores it in @dst. Callers - * are responsible for freeing @dst. - * - * Returns 0 on success, -1 on error. - */ -int -virStringListCopy(char ***dst, - const char **src) -{ - char **copy = NULL; - size_t i; - - *dst = NULL; - - if (!src) - return 0; - - if (VIR_ALLOC_N(copy, virStringListLength(src) + 1) < 0) - goto error; - - for (i = 0; src[i]; i++) - copy[i] = g_strdup(src[i]); - - *dst = copy; - return 0; - - error: - virStringListFree(copy); - return -1; -} - - /** * virStringListFree: * @strings: a NULL-terminated array of strings to free diff --git a/src/util/virstring.h b/src/util/virstring.h index 360c68395c..462a6c092c 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -47,9 +47,6 @@ void virStringListRemove(char ***strings, int virStringListMerge(char ***dst, char ***src); -int virStringListCopy(char ***dst, - const char **src); - void virStringListFree(char **strings); void virStringListAutoFree(char ***strings); void virStringListFreeCount(char **strings, -- 2.26.2
Attachment:
signature.asc
Description: PGP signature