]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: remove virStringListCopy
authorJán Tomko <jtomko@redhat.com>
Sun, 2 Aug 2020 11:37:20 +0000 (13:37 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Aug 2020 13:37:36 +0000 (15:37 +0200)
The g_strdupv function from GLib provides
the same functionality.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/util/virstring.c
src/util/virstring.h

index 2d7ddc467688fb1ed41ce80e8aaed6a1a03985e9..9da811b2ecd5e62b5c7ed6fe11f6930e5bccf839 100644 (file)
@@ -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
index c812157287f44c8bc3cb2644fec1cb9a9a4a5d47..00be9519562423eea5ac0dd50fc43d5762591060 100644 (file)
@@ -45,9 +45,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,