]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: virsh: cmdDominfo: rename 'ostype' variable
authorJán Tomko <jtomko@redhat.com>
Wed, 11 Aug 2021 14:16:39 +0000 (16:16 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 16 Aug 2021 11:10:33 +0000 (13:10 +0200)
Use 'ostype' instead of generic 'str', to discourage
reuse. Also mark it as autofree.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tools/virsh-domain-monitor.c

index 55c8dcf11884d7c5b4753919eacc84a464e077f4..365c84fb5bc82937ca454027f570adfd4a6a0cde 100644 (file)
@@ -1276,7 +1276,8 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
     bool ret = true;
     int autostart;
     unsigned int id;
-    char *str, uuid[VIR_UUID_STRING_BUFLEN];
+    char uuid[VIR_UUID_STRING_BUFLEN];
+    g_autofree char *ostype = NULL;
     int has_managed_save = 0;
     virshControl *priv = ctl->privData;
     g_auto(GStrv) messages = NULL;
@@ -1294,10 +1295,8 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
     if (virDomainGetUUIDString(dom, &uuid[0]) == 0)
         vshPrint(ctl, "%-15s %s\n", _("UUID:"), uuid);
 
-    if ((str = virDomainGetOSType(dom))) {
-        vshPrint(ctl, "%-15s %s\n", _("OS Type:"), str);
-        VIR_FREE(str);
-    }
+    if ((ostype = virDomainGetOSType(dom)))
+        vshPrint(ctl, "%-15s %s\n", _("OS Type:"), ostype);
 
     if (virDomainGetInfo(dom, &info) == 0) {
         vshPrint(ctl, "%-15s %s\n", _("State:"),