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

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



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


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