util: remove virStringListCopy

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>
This commit is contained in:
Ján Tomko 2020-08-02 13:37:20 +02:00
parent 1d40d83336
commit 201dcc1690
2 changed files with 0 additions and 40 deletions

View 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

View 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,