The returned argument list is a NULL-terminated string list and the only caller doesn't use the count. Remove the argument. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/util/vircommand.c | 4 +--- src/util/vircommand.h | 2 +- tests/qemuxml2argvtest.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8e372c3152..fead373729 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2164,8 +2164,7 @@ virCommandToString(virCommand *cmd, int virCommandGetArgList(virCommand *cmd, - char ***args, - size_t *nargs) + char ***args) { size_t i; @@ -2175,7 +2174,6 @@ virCommandGetArgList(virCommand *cmd, } *args = g_new0(char *, cmd->nargs); - *nargs = cmd->nargs - 1; for (i = 1; i < cmd->nargs; i++) (*args)[i - 1] = g_strdup(cmd->args[i]); diff --git a/src/util/vircommand.h b/src/util/vircommand.h index fb6c3b5d12..600806a987 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -178,7 +178,7 @@ int virCommandToStringBuf(virCommand *cmd, bool linebreaks, bool stripCommandPath); -int virCommandGetArgList(virCommand *cmd, char ***args, size_t *nargs); +int virCommandGetArgList(virCommand *cmd, char ***args); int virCommandExec(virCommand *cmd, gid_t *groups, int ngroups) G_GNUC_WARN_UNUSED_RESULT; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b5fab1178c..330804f446 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -560,7 +560,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, g_auto(GStrv) args = NULL; g_autoptr(virDomainObj) vm = NULL; qemuDomainObjPrivate *priv = NULL; - size_t nargs = 0; GHashTable *schema = NULL; g_autoptr(virCommand) cmd = NULL; unsigned int parseFlags = info->parseFlags; @@ -602,7 +601,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, if (!(cmd = testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info, flags))) return -1; - if (virCommandGetArgList(cmd, &args, &nargs) < 0) + if (virCommandGetArgList(cmd, &args) < 0) return -1; if (testCompareXMLToArgvValidateSchemaCommand(args, schema) < 0) -- 2.31.1