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

Ján Tomko posted 6 patches 6 years, 12 months ago
[libvirt] [PATCH 2/6] tools: use NULLSTR_MINUS
Posted by Ján Tomko 6 years, 12 months ago
Use the newly introduced macro in the few places that open-code it.

Signed-off-by: Ján Tomko <jtomko@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/6] tools: use NULLSTR_MINUS
Posted by Andrea Bolognani 6 years, 11 months ago
On Tue, 2019-02-12 at 17:40 +0100, Ján Tomko wrote:
> Use the newly introduced macro in the few places that open-code it.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  tools/virsh-domain-monitor.c | 4 ++--
>  tools/virsh-snapshot.c       | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

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