[libvirt] [PATCH 2/6] tools: use NULLSTR_MINUS

Ján Tomko jtomko at redhat.com
Tue Feb 12 16:40:36 UTC 2019


Use the newly introduced macro in the few places that open-code it.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tools/virsh-domain-monitor.c | 4 ++--
 tools/virsh-snapshot.c       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 1897a626d5..49de81af8c 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -643,11 +643,11 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
                                 "|./source/@volume)", ctxt);
         if (details) {
             if (vshTableRowAppend(table, type, device, target,
-                                  source ? source : "-", NULL) < 0)
+                                  NULLSTR_MINUS(source), NULL) < 0)
                 goto cleanup;
         } else {
             if (vshTableRowAppend(table, target,
-                                  source ? source : "-", NULL) < 0)
+                                  NULLSTR_MINUS(source), NULL) < 0)
                 goto cleanup;
         }
 
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 6d8e2b299b..90000ef1aa 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -945,7 +945,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd)
     /* Since we already have the XML, there's no need to call
      * virDomainSnapshotGetParent */
     parent = virXPathString("string(/domainsnapshot/parent/name)", ctxt);
-    vshPrint(ctl, "%-15s %s\n", _("Parent:"), parent ? parent : "-");
+    vshPrint(ctl, "%-15s %s\n", _("Parent:"), NULLSTR_MINUS(parent));
 
     /* Children, Descendants.  After this point, the fallback to
      * compute children is too expensive, so we gracefully quit if the
-- 
2.20.1




More information about the libvir-list mailing list