Skip to content

Commit 201dcc1

Browse files
committed
util: remove virStringListCopy
The g_strdupv function from GLib provides the same functionality. Signed-off-by: Ján Tomko <[email protected]> Reviewed-by: Martin Kletzander <[email protected]>
1 parent 1d40d83 commit 201dcc1

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

src/util/virstring.c

-37
Original file line numberDiff line numberDiff line change
@@ -259,43 +259,6 @@ virStringListMerge(char ***dst,
259259
}
260260

261261

262-
/**
263-
* virStringListCopy:
264-
* @dst: where to store the copy of @strings
265-
* @src: a NULL-terminated array of strings
266-
*
267-
* Makes a deep copy of the @src string list and stores it in @dst. Callers
268-
* are responsible for freeing @dst.
269-
*
270-
* Returns 0 on success, -1 on error.
271-
*/
272-
int
273-
virStringListCopy(char ***dst,
274-
const char **src)
275-
{
276-
char **copy = NULL;
277-
size_t i;
278-
279-
*dst = NULL;
280-
281-
if (!src)
282-
return 0;
283-
284-
if (VIR_ALLOC_N(copy, virStringListLength(src) + 1) < 0)
285-
goto error;
286-
287-
for (i = 0; src[i]; i++)
288-
copy[i] = g_strdup(src[i]);
289-
290-
*dst = copy;
291-
return 0;
292-
293-
error:
294-
virStringListFree(copy);
295-
return -1;
296-
}
297-
298-
299262
/**
300263
* virStringListFree:
301264
* @strings: a NULL-terminated array of strings to free

src/util/virstring.h

-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ void virStringListRemove(char ***strings,
4545
int virStringListMerge(char ***dst,
4646
char ***src);
4747

48-
int virStringListCopy(char ***dst,
49-
const char **src);
50-
5148
void virStringListFree(char **strings);
5249
void virStringListAutoFree(char ***strings);
5350
void virStringListFreeCount(char **strings,

0 commit comments

Comments
 (0)