[PATCH 02/10] virsh: use g_strdup in cmdDomblkinfoGet

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

 



Prefer GLib's g_strdup to vshStrdup.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tools/virsh-domain-monitor.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index cd675df07d..739c8df381 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -420,17 +420,16 @@ static const vshCmdOptDef opts_domblkinfo[] = {
 };
 
 static bool
-cmdDomblkinfoGet(vshControl *ctl,
-                 const virDomainBlockInfo *info,
+cmdDomblkinfoGet(const virDomainBlockInfo *info,
                  char **cap,
                  char **alloc,
                  char **phy,
                  bool human)
 {
     if (info->capacity == 0 && info->allocation == 0 && info->physical == 0) {
-        *cap = vshStrdup(ctl, "-");
-        *alloc = vshStrdup(ctl, "-");
-        *phy = vshStrdup(ctl, "-");
+        *cap = g_strdup("-");
+        *alloc = g_strdup("-");
+        *phy = g_strdup("-");
     } else if (!human) {
         if (virAsprintf(cap, "%llu", info->capacity) < 0 ||
             virAsprintf(alloc, "%llu", info->allocation) < 0 ||
@@ -530,7 +529,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
                 memset(&info, 0, sizeof(info));
             }
 
-            if (!cmdDomblkinfoGet(ctl, &info, &cap, &alloc, &phy, human))
+            if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human))
                 goto cleanup;
             if (vshTableRowAppend(table, target, cap, alloc, phy, NULL) < 0)
                 goto cleanup;
@@ -545,7 +544,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
         if (virDomainGetBlockInfo(dom, device, &info, 0) < 0)
             goto cleanup;
 
-        if (!cmdDomblkinfoGet(ctl, &info, &cap, &alloc, &phy, human))
+        if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human))
             goto cleanup;
         vshPrint(ctl, "%-15s %s\n", _("Capacity:"), cap);
         vshPrint(ctl, "%-15s %s\n", _("Allocation:"), alloc);
-- 
2.21.0

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