[libvirt PATCH 5/6] util: recommend g_strfreev instead of virStringListFree

Ján Tomko jtomko at redhat.com
Sun Aug 2 22:25:33 UTC 2020


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/util/virfile.c   | 4 ++--
 src/util/virstring.c | 8 ++++----
 tools/vsh.c          | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 6599971ba5..4b683a597c 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2067,7 +2067,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath G_GNUC_UNUSED,
  * the path @prefix, sorted alphabetically.
  *
  * The @mountsret array will be NULL terminated and should
- * be freed with virStringListFree
+ * be freed with g_strfreev
  *
  * Returns 0 on success, -1 on error
  */
@@ -2090,7 +2090,7 @@ int virFileGetMountSubtree(const char *mtabpath,
  * the path @prefix, reverse-sorted alphabetically.
  *
  * The @mountsret array will be NULL terminated and should
- * be freed with virStringListFree
+ * be freed with g_strfreev
  *
  * Returns 0 on success, -1 on error
  */
diff --git a/src/util/virstring.c b/src/util/virstring.c
index a63f92d9a7..b31d4743f2 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -64,7 +64,7 @@ VIR_LOG_INIT("util.string");
  * before calling virStringSplit().
  *
  * Return value: a newly-allocated NULL-terminated array of strings. Use
- *    virStringListFree() to free it.
+ *    g_strfreev() to free it.
  */
 char **
 virStringSplitCount(const char *string,
@@ -252,7 +252,7 @@ virStringListMerge(char ***dst,
     for (i = 0; i <= src_len; i++)
         (*dst)[i + dst_len] = (*src)[i];
 
-    /* Don't call virStringListFree() as it would free strings in
+    /* Don't call g_strfreev() as it would free strings in
      * @src. */
     VIR_FREE(*src);
     return 0;
@@ -900,7 +900,7 @@ int virStringSortRevCompare(const void *a, const void *b)
  * @matches: pointer to an array to be filled with NULL terminated list of matches
  *
  * Performs a POSIX extended regex search against a string and return all matching substrings.
- * The @matches value should be freed with virStringListFree() when no longer
+ * The @matches value should be freed with g_strfreev() when no longer
  * required.
  *
  * @code
@@ -920,7 +920,7 @@ int virStringSortRevCompare(const void *a, const void *b)
  *  // matches[2] == "bbb3c75c-d60f-43b0-b802-fd56b84a4222"
  *  // matches[3] == NULL;
  *
- *  virStringListFree(matches);
+ *  g_strfreev(matches);
  * @endcode
  *
  * Returns: -1 on error, or number of matches
diff --git a/tools/vsh.c b/tools/vsh.c
index ee93c769d7..b3be31264d 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -130,7 +130,7 @@ vshNameSorter(const void *a, const void *b)
 /*
  * Convert the strings separated by ',' into array. The returned
  * array is a NULL terminated string list. The caller has to free
- * the array using virStringListFree or a similar method.
+ * the array using g_strfreev or a similar method.
  *
  * Returns the length of the filled array on success, or -1
  * on error.
-- 
2.26.2




More information about the libvir-list mailing list