Re: [dbus PATCH 6/8] Introduce virtDBusUtilStringListFree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 19, 2018 at 03:58:05PM +0200, Katerina Koukiou wrote:
virtDBusUtilStringListFree is an autoptr cleanup function
for gchar ** type.

Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
src/util.c | 9 +++++++++
src/util.h | 7 +++++++
2 files changed, 16 insertions(+)

diff --git a/src/util.c b/src/util.c
index b21f2c5..75f77e3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -184,3 +184,12 @@ virtDBusUtilVirNetworkListFree(virNetworkPtr *networks)

    g_free(networks);
}
+
+void
+virtDBusUtilStringListFree(GCharArray *item)
+{
+    for (gint i = 0; item[i] != NULL; i += 1)

i++, please

+        g_free(item[i]);
+
+    g_free(item);
+}
diff --git a/src/util.h b/src/util.h
index 5141172..7ae4705 100644
--- a/src/util.h
+++ b/src/util.h
@@ -82,3 +82,10 @@ virtDBusUtilVirNetworkListFree(virNetworkPtr *networks);

G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetwork, virNetworkFree);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkPtr, virtDBusUtilVirNetworkListFree);
+
+typedef gchar *GCharArray;
+

This is the naming convention used by glib,
custom types should use the virtDBus prefix.

Jano

+void
+virtDBusUtilStringListFree(GCharArray *item);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCharArray, virtDBusUtilStringListFree);
--
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux