[PATCH 2/2] util: command: Deduplicate code in virCommandNewArgList

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

 



virCommandNewArgList can use virCommandNewVAList.
---
 src/util/vircommand.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 648f5ed..c41bd7f 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -919,17 +919,13 @@ virCommandNewArgs(const char *const*args)
 virCommandPtr
 virCommandNewArgList(const char *binary, ...)
 {
-    virCommandPtr cmd = virCommandNew(binary);
+    virCommandPtr cmd;
     va_list list;
-    const char *arg;
-
-    if (!cmd || cmd->has_error)
-        return cmd;

     va_start(list, binary);
-    while ((arg = va_arg(list, const char *)) != NULL)
-        virCommandAddArg(cmd, arg);
+    cmd = virCommandNewVAList(binary, list);
     va_end(list);
+
     return cmd;
 }

-- 
2.3.5

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